/* ============================================================
   AMORADES — Design System v0.77
   Fintech-grade, responsive, auth + multi-role UI
   ============================================================ */

:root {
  /* Brand — AmoraDes */
  --brand-50:  #f5f3ff;
  --brand-100: #ede9fe;
  --brand-200: #ddd6fe;
  --brand-300: #c4b5fd;
  --brand-400: #a78bfa;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --brand-800: #5b21b6;

  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #d946ef 100%);
  --gradient-subtle:  linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  --gradient-auth:    linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #a855f7 100%);

  /* Neutrals */
  --bg:         #f5f7fb;
  --bg-elev:    #ffffff;
  --bg-muted:   #f8f9fc;
  --border:     #e6e8ef;
  --border-strong: #d1d5db;

  --text:       #0f1629;
  --text-soft:  #4b5563;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  /* Semantic */
  --success: #10b981;
  --success-bg: #d1fae5;
  --danger:  #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --info:    #3b82f6;
  --info-bg: #dbeafe;

  /* Radius */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 22, 41, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 22, 41, 0.05), 0 1px 2px rgba(15, 22, 41, 0.04);
  --shadow:    0 4px 14px rgba(15, 22, 41, 0.06), 0 2px 4px rgba(15, 22, 41, 0.04);
  --shadow-md: 0 10px 28px rgba(15, 22, 41, 0.08), 0 4px 10px rgba(15, 22, 41, 0.04);
  --shadow-lg: 0 24px 50px rgba(15, 22, 41, 0.12), 0 10px 20px rgba(15, 22, 41, 0.06);
  --shadow-brand: 0 10px 24px rgba(124, 58, 237, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition: 200ms var(--ease);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 72px;

  /* Mobile App Bottom Nav Variables */
  --bottom-nav-h: 72px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   Reset
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ============================================================
   Splash
   ============================================================ */

.splash {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 9999;
  transition: opacity 400ms var(--ease);
}
.splash.hidden { opacity: 0; pointer-events: none; }

.splash-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.splash-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: white;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow-brand);
}
.splash-loader {
  width: 44px;
  height: 44px;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   AUTH — Login, Register, Forgot
   ============================================================ */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background: var(--bg);
}

.auth-hero {
  position: relative;
  background: var(--gradient-auth);
  color: white;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.auth-hero::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -150px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(217, 70, 239, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.auth-hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.auth-hero-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.auth-hero-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.auth-hero-brand-text > span:first-child {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.auth-hero-brand-version {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 3px;
}
.auth-hero-brand span {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-hero-content {
  position: relative;
  z-index: 1;
  max-width: 440px;
}
.auth-hero-content h1 {
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
}
.auth-hero-content p {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 32px;
}

.auth-hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 24px;
}
.auth-hero-stat {
  display: flex;
  flex-direction: column;
}
.auth-hero-stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.auth-hero-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.auth-hero-footer {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.auth-panel {
  background: var(--bg-elev);
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

.auth-form-wrap {
  width: 100%;
  max-width: 380px;
  margin: auto 0;
}

.auth-form-head {
  margin-bottom: 32px;
}
.auth-form-head h2 {
  font-size: 26px;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.auth-form-head p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.auth-form .form-group { margin-bottom: 16px; }

.auth-form .form-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-form .form-footer a {
  color: var(--brand-600);
  font-weight: 600;
}
.auth-form .form-footer a:hover { text-decoration: underline; }

.auth-btn-full {
  width: 100%;
  height: 46px;
  font-size: 14px;
  justify-content: center;
}

.auth-forgot-link {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--brand-600);
  font-weight: 600;
  margin-top: 6px;
}
.auth-forgot-link:hover { text-decoration: underline; }

/* Seletor de tipo de cadastro */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.type-option {
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.type-option:hover { border-color: var(--brand-300); }
.type-option.active {
  border-color: var(--brand-600);
  background: var(--brand-50);
}
.type-option-icon {
  font-size: 22px;
  margin-bottom: 4px;
}
.type-option-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.type-option-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   App Shell
   ============================================================ */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

/* ============================================================
   Sidebar (Desktop)
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 40;
}

.sidebar-header {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient-primary);
  color: white;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.logo-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.1;
}
.logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.logo-version {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-muted);
}
.sidebar-close:hover { background: var(--bg-muted); }

.role-badge {
  margin: 0 20px 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.role-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-600);
}
.role-badge.admin {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.role-badge.admin .role-badge-dot { background: #d97706; }

.nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
}

.nav-section { margin-bottom: 20px; }

.nav-label {
  display: block;
  padding: 12px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover {
  background: var(--bg-muted);
  color: var(--text);
}
.nav-item.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}
.nav-badge.alert {
  background: var(--danger);
  color: white;
}
.nav-item.active .nav-badge { background: var(--brand-600); color: white; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-muted);
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.user-card:hover { background: var(--brand-50); }

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient-primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.user-plan {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.user-card svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 41, 0.4);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}
.sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

/* ============================================================
   Main
   ============================================================ */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-title h1 {
  font-size: 20px;
  letter-spacing: -0.02em;
}
.topbar-title p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-summary {
  display: flex;
  flex-direction: column;
  text-align: right;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.topbar-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.topbar-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid white;
}

.sidebar-toggle { display: none; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: var(--transition);
  white-space: nowrap;
  height: 40px;
}
.btn svg { width: 16px; height: 16px; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(124, 58, 237, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  color: white;
}

/* ============================================================
   Content
   ============================================================ */

.content {
  padding: 28px 32px 48px;
  flex: 1;
  animation: fadeIn 280ms var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   KPI Cards (Dashboard)
   ============================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-200);
}
.kpi-card.featured {
  background: var(--gradient-primary);
  color: white;
  border: none;
}
.kpi-card.featured::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kpi-card.featured .kpi-label { color: rgba(255, 255, 255, 0.85); }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-50);
  color: var(--brand-600);
}
.kpi-icon svg { width: 20px; height: 20px; stroke-linecap: round; stroke-linejoin: round; }
.kpi-card.featured .kpi-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.kpi-meta {
  margin-top: 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.kpi-card.featured .kpi-meta { color: rgba(255, 255, 255, 0.85); }
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}
.kpi-trend.up   { background: var(--success-bg); color: var(--success); }
.kpi-trend.down { background: var(--danger-bg); color: var(--danger); }
.kpi-card.featured .kpi-trend {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ============================================================
   Dashboard Grid
   ============================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-wrap {
  height: 280px;
  position: relative;
}

/* Categorias */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.category-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.category-info { flex: 1; min-width: 0; }
.category-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.category-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}
.category-bar {
  height: 6px;
  background: var(--bg-muted);
  border-radius: 3px;
  overflow: hidden;
}
.category-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 600ms var(--ease);
}

/* Recentes */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  transition: var(--transition);
}
.recent-item:hover { background: var(--bg-muted); }

.recent-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 18px;
}

.recent-info { flex: 1; min-width: 0; }
.recent-desc {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.recent-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Tabela
   ============================================================ */

.table-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-field {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search-field svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  stroke-linecap: round;
}
.search-field input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  font-size: 13px;
  color: var(--text);
  transition: var(--transition);
}
.search-field input:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-50);
}

.filter-select {
  height: 40px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
}
.filter-select:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-50);
}

.table-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  padding: 14px 20px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.table th.sortable:hover { color: var(--text); }
.table th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.4;
  font-size: 10px;
}
.table th.sort-asc  .sort-icon { opacity: 1; }
.table th.sort-desc .sort-icon { opacity: 1; transform: rotate(180deg); }

.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg-muted); }

.td-desc {
  display: flex;
  align-items: center;
  gap: 12px;
}
.td-desc-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 15px;
}
.td-desc-text {
  font-weight: 600;
  color: var(--text);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-desc-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.td-value {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.tag.success { background: var(--success-bg); color: var(--success); }
.tag.warning { background: var(--warning-bg); color: var(--warning); }
.tag.danger  { background: var(--danger-bg);  color: var(--danger);  }
.tag.info    { background: var(--info-bg);    color: var(--info);    }
.tag.neutral { background: var(--bg-muted); color: var(--text-muted); }

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.row-actions .btn-icon {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  background: transparent;
}
.row-actions .btn-icon:hover { background: var(--bg-muted); color: var(--text); }
.row-actions .btn-icon.success:hover { background: var(--success-bg); color: var(--success); }
.row-actions .btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }
.row-actions .btn-icon svg { width: 16px; height: 16px; stroke-linecap: round; stroke-linejoin: round; }

/* Empty state */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
}
.empty-icon svg { width: 32px; height: 32px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 13px; margin: 0 0 20px; }
.empty-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Pagination */
.table-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-muted);
  gap: 12px;
  flex-wrap: wrap;
}
.pag-info { font-size: 12px; color: var(--text-muted); }
.pag-nav { display: flex; gap: 4px; }
.pag-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.pag-btn:hover:not(:disabled) { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.pag-btn.active { background: var(--gradient-primary); color: white; border-color: transparent; }
.pag-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 41, 0.5);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 200ms var(--ease);
}
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--bg-elev);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 280ms var(--ease);
}
.modal.wide { max-width: 720px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 24px 28px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.modal-header-info h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.modal-header-info p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg-muted); color: var(--text); }

.modal-body { padding: 24px 28px; }

.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   Form
   ============================================================ */

.form-group { margin-bottom: 16px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  font-size: 14px;
  color: var(--text);
  transition: var(--transition);
  font-family: inherit;
}
.form-textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 14px;
  resize: vertical;
}
.form-select {
  appearance: none;
  background: var(--bg-elev) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  padding-right: 40px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-50);
}

.form-input.error,
.form-select.error { border-color: var(--danger); }
.form-input.valid { border-color: var(--success); }

.form-error {
  margin-top: 4px;
  font-size: 12px;
  color: var(--danger);
}
.form-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.permission-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-muted);
  font-size: 12px;
  color: var(--text-soft);
}
.permission-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600);
  flex-shrink: 0;
}

.amount-field { position: relative; }
.amount-field::before {
  content: 'R$';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 1;
}
.amount-field input { padding-left: 42px; font-weight: 600; font-variant-numeric: tabular-nums; }

.input-group {
  position: relative;
}
.input-group .form-input { padding-right: 44px; }
.input-group-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.input-group-icon:hover { background: var(--bg-muted); color: var(--text); }
.input-group-icon svg { width: 16px; height: 16px; stroke-linecap: round; stroke-linejoin: round; }

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
}
.checkbox-field:hover { background: var(--brand-50); border-color: var(--brand-200); }
.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand-600);
}

/* ============================================================
   Toast
   ============================================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  pointer-events: auto;
  animation: toastIn 280ms var(--ease);
}
.toast.out { animation: toastOut 200ms var(--ease) forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px); }
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
}
.toast.success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast.error   .toast-icon { background: var(--danger-bg); color: var(--danger); }
.toast.info    .toast-icon { background: var(--info-bg); color: var(--info); }
.toast.warning .toast-icon { background: var(--warning-bg); color: var(--warning); }

.toast-content { flex: 1; min-width: 0; }
.toast-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.toast-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   Confirm dialog
   ============================================================ */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 41, 0.5);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 500;
  padding: 20px;
  animation: fadeIn 200ms var(--ease);
}
.confirm-overlay[hidden] { display: none; }

.confirm {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 240ms var(--ease);
}

.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--danger-bg);
  color: var(--danger);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 24px;
}
.confirm-title { font-size: 17px; margin-bottom: 8px; }
.confirm-message {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 22px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ============================================================
   Content header
   ============================================================ */

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.view-header h2 {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.view-header p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.view-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-quick-hint {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  margin: 8px 0 0;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  font-size: 13px;
  color: #065f46;
  line-height: 1.45;
}
.admin-quick-hint-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.18);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.admin-quick-hint strong { color: #064e3b; }

.modal-admin-auto-approve {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 18px;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  font-size: 12px;
  color: #065f46;
}
.modal-admin-auto-approve-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--success);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   Status / Pending banner
   ============================================================ */

.status-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.status-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(217, 119, 6, 0.15);
  color: #92400e;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 22px;
}
.status-banner-content { flex: 1; }
.status-banner-title {
  font-weight: 700;
  color: #92400e;
  font-size: 14px;
  margin-bottom: 2px;
}
.status-banner-msg {
  font-size: 13px;
  color: #78350f;
}

/* ============================================================
   Auditoria
   ============================================================ */

.audit-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(140px, 0.7fr) minmax(140px, 0.7fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.audit-ops {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 12px;
  margin-bottom: 16px;
}

.audit-op-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}

.audit-op-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.audit-op-head strong {
  font-size: 13px;
  color: var(--text);
}

.health-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-bg);
}

.health-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-bg);
}

.audit-op-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.audit-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.audit-metric-label,
.audit-backup-line span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.audit-metric strong,
.audit-backup-line strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.audit-metric strong.ok { color: var(--success); }
.audit-metric strong.warn { color: var(--warning); }

.audit-backup-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.audit-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.audit-summary-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}

.audit-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.audit-summary-item strong {
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.audit-table td {
  vertical-align: top;
}

.audit-extra {
  max-width: 460px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

/* ============================================================
   Relatórios, seleção em massa, comprovantes
   ============================================================ */

.relatorio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.relatorio-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.relatorio-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-300);
}

.relatorio-card.encerrado {
  background: var(--bg-muted);
  border-style: dashed;
}
.relatorio-card.encerrado::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    transparent 0 20px,
    rgba(15, 22, 41, 0.015) 20px 21px
  );
  pointer-events: none;
}

.relatorio-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}

.relatorio-card-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.relatorio-card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.relatorio-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.relatorio-card-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.relatorio-card-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.relatorio-card-stat-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: -0.015em;
}

.relatorio-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.relatorio-card-foot-action {
  color: var(--brand-600);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.relatorio-header {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.relatorio-header::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.relatorio-header.encerrado {
  background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
}

.relatorio-header-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.relatorio-header-info h2 {
  font-size: 22px;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}
.relatorio-header-info p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  margin: 0;
}

.relatorio-header-stats {
  display: flex;
  gap: 24px;
}
.relatorio-header-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.relatorio-header-stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.relatorio-header-stat-value {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.relatorio-header-actions {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.relatorio-header-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-color: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
}
.relatorio-header-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}
.relatorio-header-actions .btn-light {
  background: white;
  color: var(--brand-700);
}
.relatorio-header-actions .btn-light:hover {
  background: var(--brand-50);
  transform: translateY(-1px);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.2);
  color: white;
}
.status-pill.aberto    { background: rgba(16, 185, 129, 0.3); }
.status-pill.encerrado { background: rgba(255, 255, 255, 0.2); }

.despesa-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
  margin-bottom: 10px;
  transition: var(--transition);
  position: relative;
}
.despesa-item:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-sm);
}

.despesa-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 14px;
}

.despesa-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 20px;
}

.despesa-item-info {
  flex: 1;
  min-width: 0;
}
.despesa-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.despesa-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.despesa-item-obs {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
}

.despesa-item-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.despesa-item-valor {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.despesa-item-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-muted);
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
}
.despesa-item-thumb:hover {
  transform: scale(1.05);
  border-color: var(--brand-400);
}
.despesa-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.despesa-item-thumb.placeholder {
  color: var(--text-faint);
}
.despesa-item-thumb-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--success);
  border: 2px solid var(--bg-elev);
  border-radius: 50%;
}

.despesa-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.comprovante-upload {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-muted);
}
.comprovante-upload:hover,
.comprovante-upload.dragover {
  border-color: var(--brand-500);
  background: var(--brand-50);
}
.comprovante-upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: 12px;
  background: var(--brand-100);
  color: var(--brand-600);
  display: grid;
  place-items: center;
}
.comprovante-upload-icon svg { width: 22px; height: 22px; }
.comprovante-upload-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}
.comprovante-upload-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.comprovante-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
}
.comprovante-preview-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elev);
}
.comprovante-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.comprovante-preview-info { flex: 1; min-width: 0; }
.comprovante-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.comprovante-preview-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.comprovante-preview-remove {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--danger);
  background: var(--danger-bg);
  cursor: pointer;
  flex-shrink: 0;
}
.comprovante-preview-remove:hover { background: var(--danger); color: white; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: grid;
  place-items: center;
  z-index: 500;
  padding: 40px;
  animation: fadeIn 200ms var(--ease);
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: var(--transition);
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

.table-bulk-bar {
  display: none;
  padding: 12px 20px;
  background: var(--brand-50);
  border-bottom: 1px solid var(--brand-200);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.table-bulk-bar.active { display: flex; }
.table-bulk-info {
  font-size: 13px;
  color: var(--brand-700);
  font-weight: 600;
}
.table-bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--brand-600);
  vertical-align: middle;
}
.table tr.selected { background: var(--brand-50); }
.table tr.selected:hover { background: var(--brand-100); }

.table th.col-select,
.table td.col-select {
  width: 44px;
  padding-left: 20px;
  padding-right: 0;
}

.cpf-lookup {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: 12px;
  margin-bottom: 20px;
}
.cpf-lookup-result {
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.cpf-lookup-result.found { border-color: var(--success); background: var(--success-bg); }
.cpf-lookup-result.not-found { border-color: var(--warning); background: var(--warning-bg); }
.cpf-lookup-result-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 16px;
}
.cpf-lookup-result.found .cpf-lookup-result-icon { background: var(--success); color: white; }
.cpf-lookup-result.not-found .cpf-lookup-result-icon { background: var(--warning); color: white; }

.cpf-lookup-result-info { flex: 1; min-width: 0; }
.cpf-lookup-result-title { font-weight: 600; font-size: 13px; color: var(--text); }
.cpf-lookup-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.import-layout-box {
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-muted);
}
.import-layout-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.import-layout-head strong {
  display: block;
  font-size: 14px;
  color: var(--text);
}
.import-layout-head span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}
.import-downloads {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.import-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
}
.import-section-title {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.import-code {
  margin: 0 0 10px;
  padding: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}
.import-rules {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}
.import-mini-table {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}
.import-mini-table span:nth-child(odd) {
  font-weight: 700;
  color: var(--text);
}
.import-mini-table span:nth-child(even) { color: var(--text-soft); }
.import-password-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.import-password-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.import-password-option {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.import-password-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-600);
}
.import-password-option:has(input:checked) {
  border-color: var(--brand-400);
  background: var(--brand-50);
  color: var(--brand-700);
}
.file-input {
  height: auto;
  min-height: 44px;
  padding: 9px 12px;
}
.import-error-box {
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: var(--danger-bg);
}
.import-error-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--danger);
}
.import-error-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}
.import-error-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}
.import-error-item span {
  font-weight: 700;
  color: var(--danger);
}
.import-error-item p {
  margin: 0;
  color: var(--text-soft);
}
.import-error-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}
.import-log-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elev);
}
.import-log-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.import-log-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.import-log-file {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.import-log-status {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.import-log-status.has-error {
  background: var(--danger-bg);
  color: var(--danger);
}
.import-log-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.import-log-summary span {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-muted);
  color: var(--text-soft);
  font-size: 12px;
}
.import-log-summary strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}
.import-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}
.import-log-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-muted);
}
.import-log-row.ok {
  border-color: var(--success);
  background: var(--success-bg);
}
.import-log-row.error {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.import-log-line {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}
.import-log-row.error .import-log-line { color: var(--danger); }
.import-log-row.ok .import-log-line { color: var(--success); }
.import-log-content { min-width: 0; }
.import-log-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.import-log-row-head strong {
  color: var(--text);
  font-size: 13px;
}
.import-log-row-head span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}
.import-log-detail {
  margin-bottom: 5px;
  color: var(--text-soft);
  font-size: 12px;
}
.import-log-content code {
  display: block;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.import-log-content ul {
  margin: 7px 0 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.45;
}

/* ============================================================
   MOBILE-FIRST (v0.77 Update) & OVERLAP FIXES
   ============================================================ */

/* Menu inferior nativo mobile (Invisível no desktop) */
.bottom-nav { display: none; }

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { min-height: auto; padding: 32px; }
  .auth-hero-content h1 { font-size: 28px; }
}

@media (max-width: 768px) {
  /* Ativação do Menu Inferior e desativação da Sidebar Lateral */
  .sidebar { display: none !important; }
  
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-h) + var(--safe-area-bottom));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(15px);
    -webkit-backdrop-filter: saturate(180%) blur(15px);
    border-top: 1px solid var(--border);
    z-index: 9999;
    padding-bottom: var(--safe-area-bottom);
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 0;
    transition: var(--transition);
  }
  .bottom-nav-item svg { width: 24px; height: 24px; stroke-width: 2; }
  .bottom-nav-item.active { color: var(--brand-600); }

  /* PROTEÇÃO CONTRA SOBREPOSIÇÃO NO CELULAR */
  .app { display: block; } /* Remove as colunas no mobile */
  .main { padding-bottom: 0; } 
  .content { 
    /* Adiciona margem embaixo igual ao tamanho do menu inferior + segurança */
    padding: 20px 16px calc(var(--bottom-nav-h) + var(--safe-area-bottom) + 40px) !important; 
  }

  /* PROTEÇÃO EM MODAIS */
  .modal-overlay { 
    align-items: flex-end; /* Modais abrem pela base no celular (estilo gaveta) */
    padding: 16px 16px calc(var(--bottom-nav-h) + var(--safe-area-bottom) + 16px); 
  }
  .modal {
    max-height: calc(100vh - var(--bottom-nav-h) - var(--safe-area-bottom) - 40px);
    border-radius: 20px;
  }

  /* Ajustes de Cabeçalho Mobile */
  .topbar { padding: 0 16px; }
  .topbar-summary { display: none; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title p { display: none; }
  .btn-primary span { display: none; }
  .btn-primary { padding: 0 12px; }

  /* Ajustes de Cards/Dashboard Mobile */
  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .kpi-card { padding: 18px; }
  .kpi-value { font-size: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .permissions-grid { grid-template-columns: 1fr; }
  .import-layout-head { flex-direction: column; }
  .import-downloads { justify-content: flex-start; }
  .import-layout-grid { grid-template-columns: 1fr; }
  .import-log-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-log-row { grid-template-columns: 1fr; gap: 4px; }
  .import-error-item { grid-template-columns: 1fr; gap: 4px; }
  .audit-filters { grid-template-columns: 1fr; }
  .audit-ops { grid-template-columns: 1fr; }
  .audit-op-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-summary { grid-template-columns: 1fr; }
  .audit-table td { align-items: flex-start; gap: 12px; }
  .audit-table td:nth-child(3) { display: flex; }
  .toast-container { left: 16px; right: 16px; top: 16px; }
  .toast { min-width: auto; max-width: none; }

  /* TRANSFORMANDO TABELAS EM CARDS (Mobile) */
  .table-wrap { overflow: visible; }
  .table, .table thead, .table tbody, .table tr, .table td, .table th { 
    display: block; 
    width: 100%; 
  }
  .table thead { display: none; }
  .table tr {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
  }
  .table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  .table td:last-child { border-bottom: none; }
  
  .table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
  }
  
  .table td:first-child {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 700;
  }
  .table td:first-child::before { display: none; }
  
  .row-actions { 
    width: 100%; 
    justify-content: flex-start; 
    margin-top: 8px; 
  }

  /* Ajuste no Painel do Relatório */
  .relatorio-header-content { flex-direction: column; }
  .relatorio-header-stats { gap: 16px; }
  .relatorio-header-stat { align-items: flex-start; }
  .relatorio-grid { grid-template-columns: 1fr; }
  .despesa-item { flex-direction: column; align-items: stretch; }
  .despesa-item-side { justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border); }
}

@media (max-width: 480px) {
  /* Opcional para limpeza */
  .audit-op-grid { grid-template-columns: 1fr; }
  .table th:nth-child(3),
  .table td:nth-child(3) { display: none; }
  .audit-table td:nth-child(3) { display: flex; }
}
