/* ============================================================
   STYLE.CSS v4 — Sistema Financeiro PF/PJ
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --navy-900: #0a1628;
  --navy-800: #111d33;
  --navy-700: #182640;
  --navy-600: #1e3050;
  --sidebar-w: 260px;
  --sidebar-collapsed: 56px;
  --header-h: 0px;

  --blue-500: #2563eb;
  --blue-400: #3b82f6;
  --blue-300: #60a5fa;
  --green-500: #10b981;
  --green-400: #34d399;
  --green-bg: rgba(16, 185, 129, 0.1);
  --red-500: #ef4444;
  --red-400: #f87171;
  --red-bg: rgba(239, 68, 68, 0.1);
  --yellow-500: #f59e0b;
  --yellow-400: #fbbf24;
  --yellow-bg: rgba(245, 158, 11, 0.1);
  --purple-500: #7c3aed;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

/* Dark theme */
body.dark {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border: #334155;
  --border-light: #1e293b;
  --text: #e2e8f0;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}
body.dark .sidebar { background: #0c1322; }
body.dark .sidebar-nav .nav-item:hover { background: rgba(255,255,255,0.06); }
body.dark .sidebar-nav .nav-item.active { background: rgba(37,99,235,0.15); }
body.dark input, body.dark select, body.dark textarea { background: var(--bg); color: var(--text); border-color: var(--border); }
body.dark .pill { background: var(--bg); color: var(--text-secondary); border-color: var(--border); }
body.dark .pill.active { background: rgba(37,99,235,0.2); }
body.dark .btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
body.dark .modal-box { background: var(--bg-card); color: var(--text); }

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}
a { color: var(--blue-500); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================================
   LAYOUT: Sidebar + Main
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.3s ease;
  overflow: hidden;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-summary,
.sidebar.collapsed .sidebar-storage-text,
.sidebar.collapsed .storage-bar,
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-text {
  display: none;
}
.sidebar.collapsed .nav-item span:last-child {
  display: none;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}
.sidebar.collapsed .nav-item span:first-child {
  margin-right: 0;
  font-size: 18px;
}
.sidebar.collapsed .sidebar-header {
  padding: 12px 0;
  justify-content: center;
}
.sidebar.collapsed .sidebar-logo {
  margin-right: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 20px 18px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.sidebar-header:hover {
  background: rgba(255,255,255,0.05);
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

/* Nav items */
.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.nav-section {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.25);
  padding: 16px 10px 6px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 450;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}
.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 600;
}
.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}
.nav-text {
  white-space: nowrap;
}

/* CFO Radar (inside Billy panel) */
.cfo-radar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(0,0,0,0.04);
  flex-shrink: 0;
}
.dark .cfo-radar { background: rgba(0,0,0,0.15); }
.cfo-radar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.cfo-radar-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cfo-radar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.cfo-radar-value {
  font-size: 15px;
  font-weight: 700;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-primary);
}
.cfo-radar-value.green { color: #10b981; }
.cfo-radar-value.red { color: #ef4444; }
.cfo-radar-value.warn { color: #f59e0b; }
.cfo-radar-saldo {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 4px;
}
.cfo-radar-filter {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.cfo-radar-btn {
  flex: 1;
  padding: 6px 0;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.cfo-radar-btn:hover { background: rgba(59,130,246,0.1); color: var(--blue-500); }
.cfo-radar-btn.active { background: var(--blue-500); color: #fff; border-color: var(--blue-500); }
.cfo-radar-saldo strong {
  display: block;
  font-size: 18px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Sidebar Quick Input */
.sidebar-quick {
  padding: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.quick-title {
  padding: 10px 18px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quick-title:hover { color: rgba(255,255,255,0.6); }
.quick-content { padding: 0 14px 10px; }
.quick-input {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  margin-bottom: 5px;
  box-sizing: border-box;
  outline: none;
}
.quick-input:focus { border-color: rgba(255,255,255,0.25); }
.quick-input::placeholder { color: rgba(255,255,255,0.25); }
.quick-select {
  flex: 1;
  padding: 6px 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  outline: none;
  min-width: 0;
}
.quick-select option { background: #1e293b; color: #fff; }
.quick-row { display: flex; gap: 5px; margin-bottom: 5px; }
.quick-row .quick-input { margin-bottom: 0; }
.quick-valor { flex: 1; -moz-appearance: textfield; }
.quick-valor::-webkit-outer-spin-button, .quick-valor::-webkit-inner-spin-button { -webkit-appearance: none; }
.quick-btn {
  width: 100%;
  padding: 7px;
  background: rgba(59,130,246,0.3);
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 4px;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 2px;
}
.quick-btn:hover { background: rgba(59,130,246,0.5); color: #fff; }
.sidebar.collapsed .sidebar-quick { display: none; }

/* CFO Chat */
.cfo-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--blue-500);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: right 0.3s ease, transform 0.2s;
}
.cfo-fab:hover { transform: scale(1.08); }
.cfo-fab.active { right: 404px; }
.cfo-sidebar {
  width: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  background: var(--bg-card);
  border-left: none;
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transition: width 0.3s ease;
}
.cfo-sidebar.open { width: 400px; border-left: 1px solid var(--border-light); box-shadow: -4px 0 20px rgba(0,0,0,0.1); }
.cfo-header {
  padding: 12px 16px;
  background: var(--blue-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cfo-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.cfo-actions { display: flex; gap: 4px; }
.cfo-hbtn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.cfo-hbtn:hover { background: rgba(255,255,255,0.25); }
.cfo-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-main);
}
.cfo-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  max-width: 90%;
  word-wrap: break-word;
}
.cfo-msg.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  align-self: flex-start;
  border-radius: 12px 12px 12px 4px;
}
.cfo-msg.user {
  background: var(--blue-500);
  color: #fff;
  align-self: flex-end;
  border-radius: 12px 12px 4px 12px;
}
.cfo-msg strong { font-weight: 700; }
.cfo-typing {
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  align-self: flex-start;
}
.cfo-typing span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: cfoBounce 1.2s infinite;
}
.cfo-typing span:nth-child(2) { animation-delay: 0.2s; }
.cfo-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cfoBounce { 0%,80%,100% { transform: translateY(0); } 40% { transform: translateY(-5px); } }
.cfo-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cfo-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px;
  outline: none;
  background: var(--bg-main);
  color: var(--text-primary);
}
.cfo-input-area input:focus { border-color: var(--blue-500); }
.cfo-input-area button {
  padding: 10px 16px;
  border: none;
  background: var(--blue-500);
  color: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}
.cfo-input-area button:hover { opacity: 0.9; }
@media (max-width: 900px) {
  .cfo-sidebar.open { width: 100%; }
  .cfo-fab.active { right: 24px; }
}

/* DRE */
.dre-section { background: var(--bg-card); border-radius: var(--radius-md); border: 1px solid var(--border-light); overflow: hidden; }
.dre-section-title { padding: 12px 16px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; background: var(--bg-hover); }
.dre-items { }
.dre-item { border-bottom: 1px solid var(--border-light); }
.dre-item-header { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 13px; }
.dre-item-header:hover { background: var(--bg-hover); }
.dre-subs { display: none; padding: 0 16px 8px 32px; }
.dre-subs.open { display: block; }
.dre-sub { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12px; color: var(--text-secondary); }
.dre-total { padding: 12px 16px; font-size: 14px; font-weight: 700; display: flex; justify-content: space-between; border-top: 2px solid var(--border-light); }
.dre-resultado { margin-top: 16px; padding: 16px; background: var(--bg-card); border-radius: var(--radius-md); border: 2px solid var(--border-light); font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; }

/* Stat card (for fluxo indicators) */
.stat-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 16px; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; }

/* Badge */
.badge-blue { background: rgba(59,130,246,0.1); color: var(--blue-500); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-purple { background: rgba(139,92,246,0.1); color: #8b5cf6; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* Sidebar summary */
.sidebar-summary {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

/* Sidebar storage */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sidebar-storage-text {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 6px;
}
.storage-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.storage-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--blue-500);
  transition: width 0.3s ease;
}
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  color: rgba(255,255,255,0.3);
  transition: color var(--transition);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  font-size: 16px;
}
.sidebar-toggle:hover {
  color: rgba(255,255,255,0.6);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}
.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* Pages */
.page {
  display: none;
  padding: 24px 28px;
}
.page.active {
  display: block;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-hero {
  position: relative;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0a1628 0%, #1e3a5f 50%, #0a1628 100%);
  padding: 40px 36px;
  margin-bottom: 24px;
  overflow: hidden;
  min-height: 160px;
}
.dash-hero img {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.5;
}
.dash-hero-content {
  position: relative; z-index: 1;
}
.dash-greeting {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}
.dash-date {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}
.dash-hero-actions {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.hero-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
}
.hero-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* Dashboard filters */
.dash-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.dash-toggles {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.toggle-label input[type="checkbox"] {
  accent-color: var(--blue-500);
}

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.green-bg { background: var(--green-bg); }
.red-bg   { background: var(--red-bg); }
.blue-bg  { background: rgba(37,99,235,0.1); }
.yellow-bg{ background: var(--yellow-bg); }
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.stat-value.green { color: var(--green-500); }
.stat-value.red   { color: var(--red-500); }
.stat-value.blue  { color: var(--blue-500); }

/* Chart filters row */
.dash-chart-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Charts */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.chart-card.full {
  grid-column: 1 / -1;
}
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.chart-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.chart-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.chart-wrap {
  position: relative;
  height: 260px;
}

/* Recent table (dashboard) */
.recent-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.recent-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ============================================================
   COMMON: Tables
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
  user-select: none;
}
th[onclick], th.sortable {
  cursor: pointer;
  transition: color var(--transition);
}
th[onclick]:hover, th.sortable:hover {
  color: var(--text-primary);
}
td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tr:hover td {
  background: var(--bg-hover);
}
tr.selected-row td {
  background: rgba(37, 99, 235, 0.04);
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-receita {
  background: var(--green-bg);
  color: var(--green-500);
}
.badge-despesa {
  background: var(--red-bg);
  color: var(--red-500);
}
.badge-pf {
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue-500);
}
.badge-pj {
  background: var(--yellow-bg);
  color: var(--yellow-500);
}
.badge-known {
  background: var(--green-bg);
  color: var(--green-500);
}
.badge-suggestion {
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue-500);
}
.badge-doubt {
  background: var(--yellow-bg);
  color: var(--yellow-500);
}
.badge-unknown {
  background: var(--red-bg);
  color: var(--red-500);
}

/* ============================================================
   COMMON: Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--blue-500);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}
.btn-secondary {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}
.btn-success {
  background: var(--green-500);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #059669;
}
.btn-danger {
  background: var(--red-500);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-icon {
  padding: 4px 6px;
  font-size: 14px;
}
.btn-block {
  display: flex;
  width: 100%;
  justify-content: center;
}

/* ============================================================
   COMMON: Form Controls
   ============================================================ */
.fi, .fs {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition);
  outline: none;
}
.fi:focus, .fs:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.fl {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.fg {
  margin-bottom: 12px;
}
.fr2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fr3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ============================================================
   PILLS (filter buttons)
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
select.pill {
  padding-right: 28px;
}
.pill:hover {
  border-color: var(--blue-400);
  color: var(--blue-500);
}
.pill.active {
  background: var(--blue-500);
  color: #fff;
  border-color: var(--blue-500);
}
.filter-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   LANÇAMENTOS
   ============================================================ */
.lanc-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lanc-search {
  margin-bottom: 12px;
}
.lanc-search input {
  width: 100%;
  max-width: 360px;
}
.mass-bar {
  display: none;
  background: rgba(37,99,235,0.04);
  border: 1px solid var(--blue-400);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 12px;
  align-items: center;
  gap: 10px;
}
.mass-bar.visible {
  display: flex;
}
.lanc-paging {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.paging-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}
.pg-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition);
}
.pg-btn:hover:not(:disabled) {
  background: var(--bg-hover);
}
.pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.lanc-subtotal {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-top: 8px;
  gap: 20px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  flex-wrap: wrap;
}

/* ============================================================
   IMPORTAR
   ============================================================ */
.import-config {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--blue-400);
  background: rgba(37, 99, 235, 0.03);
}
.upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}
.upload-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.import-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.import-review {
  margin-top: 16px;
}
.import-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.import-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
}
.import-stats span {
  font-weight: 600;
}

/* Import table inline edit */
.import-table td select,
.import-table td input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg-card);
}
.import-table td {
  padding: 6px 8px;
  font-size: 12px;
}
.import-table th {
  padding: 8px;
  font-size: 10px;
}
.import-table tr.skip-row {
  opacity: 0.35;
  text-decoration: line-through;
}
.import-table tr.dup-row {
  background: rgba(245, 158, 11, 0.06);
}

/* Status indicators */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.status-dot.green  { background: var(--green-500); }
.status-dot.blue   { background: var(--blue-500); }
.status-dot.orange { background: var(--yellow-500); }
.status-dot.red    { background: var(--red-500); }

/* ============================================================
   CATEGORIAS
   ============================================================ */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.cat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.cat-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  transition: background var(--transition);
}
.cat-item:hover {
  background: var(--bg-hover);
}
.cat-subs {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 28px;
  padding: 2px 0 6px;
}

/* ============================================================
   INVESTIMENTOS
   ============================================================ */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.inv-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.inv-account {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.inv-balance {
  font-size: 22px;
  font-weight: 700;
  color: var(--blue-500);
}
.inv-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   CONTACTS (Clientes / Fornecedores)
   ============================================================ */
.contacts-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border-light);
  width: fit-content;
}
.tab {
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
}
.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.tab:hover:not(.active) {
  color: var(--text-secondary);
}
.contact-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--transition);
}
.contact-card:hover {
  box-shadow: var(--shadow-md);
}
.contact-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-400), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ============================================================
   TAGS
   ============================================================ */
.tag-grid {
  display: block;
  width: 100%;
}
.tag-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow var(--transition);
}
.tag-card:hover {
  box-shadow: var(--shadow-md);
}
.tag-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tag-info {
  flex: 1; min-width: 0;
}
.tag-label {
  font-size: 13px;
  font-weight: 600;
}
.tag-desc-text {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   RECORRENTES
   ============================================================ */
.rec-total-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}
.rec-total-item {
  text-align: center;
}
.rec-total-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.rec-total-value {
  font-size: 20px;
  font-weight: 700;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal.wide {
  max-width: 900px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  transition: color var(--transition);
}
.modal-close:hover {
  color: var(--text-primary);
}
.modal-body {
  padding: 20px 24px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
.confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-overlay.open {
  display: flex;
}
.confirm-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.confirm-msg {
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}
.confirm-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ============================================================
   FULLSCREEN CHART
   ============================================================ */
.fs-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.fs-overlay.open {
  display: flex;
}
.fs-box {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 92vw;
  height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.fs-head span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.fs-body {
  flex: 1;
  padding: 16px;
  position: relative;
}
.fs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.fs-title {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
}
.fs-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition);
}
.fs-close:hover {
  background: rgba(255,255,255,0.2);
}
.fs-chart-wrap {
  flex: 1;
  position: relative;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-box {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   SCOPE DIALOG
   ============================================================ */
.scope-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scope-opt {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.scope-opt:hover {
  border-color: var(--blue-400);
}
.scope-opt.sel {
  border-color: var(--blue-500);
  background: rgba(37, 99, 235, 0.04);
}
.scope-opt-title {
  font-weight: 600;
  font-size: 14px;
}
.scope-opt-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-info {
  background: rgba(37, 99, 235, 0.06);
  color: var(--blue-500);
  border: 1px solid rgba(37, 99, 235, 0.15);
}
.alert-warn {
  background: rgba(245, 158, 11, 0.06);
  color: var(--yellow-500);
  border: 1px solid rgba(245, 158, 11, 0.15);
}
.alert-success {
  background: rgba(16, 185, 129, 0.06);
  color: var(--green-500);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

/* ============================================================
   EXPORTAR
   ============================================================ */
.export-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.export-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.export-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue-400);
}
.export-icon {
  font-size: 32px;
  margin-bottom: 10px;
}
.export-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.export-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .cat-grid {
    grid-template-columns: 1fr;
  }
  .fr2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }
  .sidebar .sidebar-label,
  .sidebar .sidebar-summary,
  .sidebar .sidebar-storage-text,
  .sidebar .nav-text,
  .sidebar .nav-section {
    display: none;
  }
  .sidebar .sidebar-header {
    padding: 16px 0;
    justify-content: center;
  }
  .main-content {
    margin-left: var(--sidebar-collapsed);
  }
  .page {
    padding: 16px;
  }
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }
  .dash-hero {
    padding: 24px 20px;
  }
  .dash-greeting {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.hidden { display: none !important; }

/* getInvTotal helper - defined as CSS reminder; logic in JS */

/* Ranking section */
.ranking-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  max-height: 500px;
  overflow-y: auto;
}

/* AI status badge */
.badge-ai {
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}

/* Inline edit inputs */
.inline-input {
  width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg);
}
.inline-select {
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg);
}
.sortable { cursor: pointer; }

/* Ranking */
.ranking-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.badge-ai { background: rgba(124,58,237,0.1); color: #7c3aed; }

/* Column resize handles */
.col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  z-index: 10;
}
.col-resizer:hover,
.col-resizer.active {
  background: var(--blue-400);
}
table th {
  position: relative;
}

/* Sticky table headers */
.table-wrap table thead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-card);
}
.table-wrap table thead th {
  background: var(--bg-card);
}
/* btn-icon for compact buttons */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.6;
}
.btn-icon:hover {
  opacity: 1;
  background: var(--bg);
}

/* Multi-select dropdown */
.multi-drop {
  animation: fadeIn 0.15s ease;
}
.multi-drop label:hover {
  background: var(--bg);
  border-radius: 4px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Guide tables */
.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}
.guide-table th, .guide-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  text-align: left;
}
.guide-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.guide-table tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}

/* Lancamentos table full-width with word-wrap */
#pg-lancamentos .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  resize: vertical;
  min-height: 200px;
  max-height: 90vh;
}
#pg-lancamentos table {
  width: 100%;
  table-layout: auto;
}
#pg-lancamentos td,
#pg-lancamentos th {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}
#pg-lancamentos td .inline-input,
#pg-lancamentos td .inline-select {
  width: 100%;
  min-width: 60px;
}

/* Spinner */
.spinner{width:18px;height:18px;border:2px solid var(--border);border-top-color:#7c3aed;border-radius:50%;animation:spin 0.6s linear infinite;display:inline-block;}
@keyframes spin{to{transform:rotate(360deg)}}

/* Sidebar top actions */
.sidebar-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-top-actions button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-top-actions button:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.sidebar-top-actions button span {
  font-size: 11px;
}

/* Sidebar collapse button */
.sidebar-collapse-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.sidebar.collapsed .sidebar-collapse-btn {
  display: block;
  margin: 0 auto 4px;
}
