/* 
  FLASHA ENTERPRISE — Premium Dashboard Styling (Fase 1)
  Dark Mode, Glassmorphism, Micro-animations 
*/

:root {
  --bg-main: #060606;
  --bg-sidebar: rgba(14, 14, 14, 0.7);
  --bg-card: rgba(18, 18, 18, 0.6);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-focus: rgba(255, 255, 255, 0.15);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #4b5563;
  
  --brand-green: #10b981;
  --brand-purple: #8b5cf6;
  --brand-blue: #3b82f6;
  --brand-orange: #f59e0b;
  
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.dark-theme {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  overflow: hidden; /* App container handles scrolling */
}

/* ── LAYOUT ── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.03), transparent 40%),
              radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.03), transparent 40%);
}

.dashboard-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

/* ── SIDEBAR ── */
.sidebar-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.5px;
}

.text-green { color: var(--brand-green); }
.text-purple { color: var(--brand-purple); }
.text-orange { color: var(--brand-orange); }
.text-muted { color: var(--text-muted); }

.badge-b2b {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--brand-purple);
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.sidebar-nav {
  padding: 24px 16px;
  flex: 1;
}

.nav-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 8px;
}

.mt-6 { margin-top: 24px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.nav-item i {
  font-size: 20px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-item:hover i {
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.nav-item.active i {
  color: var(--brand-green);
}

/* Economic Score Widget */
.sidebar-footer {
  padding: 20px 16px;
  border-top: 1px solid var(--border-subtle);
}

.score-widget {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.score-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--brand-green);
  line-height: 1;
  margin-bottom: 12px;
}

.score-max {
  font-size: 14px;
  color: var(--text-muted);
}

.score-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 10px;
}

.score-fill {
  height: 100%;
  background: var(--brand-green);
  border-radius: 99px;
  box-shadow: 0 0 10px var(--brand-green);
}

.score-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── TOPBAR ── */
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(6, 6, 6, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 99px;
  padding: 8px 16px;
  width: 320px;
  transition: all 0.2s;
}

.topbar-search:focus-within {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.topbar-search i {
  color: var(--text-muted);
  font-size: 18px;
}

.topbar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
  font-family: 'Inter', sans-serif;
}

.topbar-search input::placeholder {
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.date-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

.date-picker:hover {
  color: var(--text-primary);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--text-primary);
}

.notification-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--brand-purple);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--brand-purple);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.user-profile:hover {
  background: rgba(255, 255, 255, 0.05);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── DASHBOARD ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--text-primary);
  color: var(--bg-main);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

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

.kpi-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.glow-green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.1);
}

.glow-purple {
  background: rgba(139, 92, 246, 0.1);
  color: var(--brand-purple);
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.1);
}

.glow-orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--brand-orange);
  box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.1);
}

.glow-blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--brand-blue);
  box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.1);
}

.kpi-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
  line-height: 1;
}

.kpi-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
}

.trend.positive {
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
}

.trend.negative {
  background: rgba(245, 158, 11, 0.1);
  color: var(--brand-orange);
}

.trend.neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.kpi-compare {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── CHARTS ── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.chart-title {
  font-size: 15px;
  font-weight: 600;
}

.chart-filters {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.chart-filter {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chart-filter.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.chart-wrapper {
  flex: 1;
  position: relative;
  min-height: 250px;
}

.doughnut-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn-small {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
}

/* ── RECENT EXPENSES TABLE ── */
.table-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.view-all {
  font-size: 12px;
  color: var(--brand-green);
  text-decoration: none;
  font-weight: 500;
}

.view-all:hover {
  text-decoration: underline;
}

.table-container {
  width: 100%;
  overflow-x: auto;
}

.expenses-table {
  width: 100%;
  border-collapse: collapse;
}

.expenses-table th {
  text-align: left;
  padding: 12px 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.expenses-table td {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.expenses-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.emp-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.emp-avatar.placeholder {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed var(--text-muted);
}

.emp-details {
  display: flex;
  flex-direction: column;
}

.emp-name {
  font-size: 13px;
  font-weight: 600;
}

.emp-dept {
  font-size: 11px;
  color: var(--text-muted);
}

.merchant-cell {
  display: flex;
  flex-direction: column;
}

.merchant-name {
  font-size: 13px;
  font-weight: 500;
}

.merchant-loc {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-txt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
}

.confidence-badge.high {
  background: rgba(139, 92, 246, 0.15);
  color: var(--brand-purple);
}

.confidence-badge.med {
  background: rgba(245, 158, 11, 0.15);
  color: var(--brand-orange);
}

.confidence-badge.placeholder-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.audit-group {
  display: flex;
  gap: 6px;
  font-size: 16px;
}

.amt-txt {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.st-pending {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.st-approved {
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════
   FASE D — DEMONSTRAÇÃO + NAVEGAÇÃO + RESPONSIVIDADE
   ═══════════════════════════════════════════════════════════════════ */

/* Faixa de demonstração */
.demo-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  font-size: 12.5px;
  color: #d8ccff;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(139, 92, 246, 0.10));
  border-bottom: 1px solid rgba(139, 92, 246, 0.35);
  font-family: 'Inter', sans-serif;
}

.demo-ribbon i { font-size: 16px; flex: none; color: #a78bfa; }
.demo-ribbon b { font-weight: 700; color: #cdb8ff; }
.demo-ribbon .demo-ribbon-back {
  margin-left: auto;
  flex: none;
  color: #d8ccff;
  font-weight: 600;
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid rgba(139, 92, 246, 0.45);
  transition: all 0.2s ease;
}
.demo-ribbon .demo-ribbon-back:hover {
  background: rgba(139, 92, 246, 0.18);
  transform: translateY(-1px);
}

/* Botão voltar (sidebar) */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}
.back-btn:hover {
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

/* Botão voltar (topbar) */
.topbar-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 99px;
  color: #a78bfa;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.08);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.topbar-back:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.6);
  color: #c4b5fd;
}

/* Tag DEMO na tabela */
.demo-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 3px 8px;
  border-radius: 99px;
}

/* Toast de demonstração */
.demo-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 17, 17, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #d8ccff;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  max-width: min(420px, 90vw);
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.demo-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── St-flagged (status) ── */
.st-flagged {
  background: rgba(245, 158, 11, 0.1);
  color: var(--brand-orange);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.st-rejected {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── RESPONSIVIDADE ── */
@media (max-width: 1024px) {
  .topbar-search { width: 200px; }
  .dashboard-scroll { padding: 24px 20px; }
  .topbar { padding: 0 20px; }
  .user-info { display: none; }
  .span-2 { grid-column: span 1; }
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  body.dark-theme { overflow: visible; }
  .app-container { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sidebar-header { height: 56px; padding: 0 16px; }
  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 12px;
  }
  .sidebar-nav .nav-label { display: none; }
  .sidebar-nav .nav-item { margin-bottom: 0; padding: 7px 10px; font-size: 12.5px; }
  .sidebar-footer { border-top: none; padding: 10px 12px; }
  .score-widget { display: none; }
  .back-btn { margin-top: 0; }
  .main-content { min-height: calc(100vh - 130px); }
  .topbar-actions { gap: 12px; }
  .topbar-search { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .demo-ribbon { flex-wrap: wrap; padding: 10px 16px; }
  .demo-ribbon .demo-ribbon-back { margin-left: 0; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { padding: 18px; }
  .kpi-value { font-size: 26px; }
  .page-title { font-size: 24px; }
  .dashboard-scroll { padding: 18px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
  .topbar { padding: 0 12px; height: 60px; }
  .date-picker { display: none; }
  .user-profile .avatar { width: 30px; height: 30px; }
  .topbar-back span { display: none; }
  .chart-container { padding: 18px; }
  .table-container { -webkit-overflow-scrolling: touch; }
  .demo-ribbon span { font-size: 11.5px; }
}

/* ═══════════════════════════════════════════════════════════════════
   FASE E — ENTERPRISE LIVE DEMO / SANDBOX FUNCIONAL (arquivo novo)
   ═══════════════════════════════════════════════════════════════════ */

/* Views (roteamento) */
.view { display: block; }

/* Torna o atributo hidden autoritativo (sem isso, .view{display:block} e
   .modal-backdrop{display:flex} sobrescrevem hidden e todo modal/aba fica visível) */
[hidden] { display: none !important; }

/* Botões e utilitários */
.link-btn {
  background: none;
  border: none;
  color: var(--brand-green);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.link-btn:hover { text-decoration: underline; background: rgba(16, 185, 129, 0.08); }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.cat-txt { font-size: 12px; color: var(--text-secondary); }
.warn-txt { font-size: 11.5px; color: var(--brand-orange); }
.muted { color: var(--text-muted); }
.mt-6 { margin-top: 24px; }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.empty-state { color: var(--text-muted); font-size: 13px; padding: 18px; text-align: center; }

.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.permission-note { font-size: 11px; color: var(--text-muted); font-style: italic; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-focus); background: rgba(255, 255, 255, 0.06); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

/* Filtros */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}
.filter-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}
.filter-search i { color: var(--text-muted); font-size: 16px; }
.filter-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
  font-family: 'Inter', sans-serif;
}
.filter-search input::placeholder { color: var(--text-muted); }

.filter-select, .filter-date {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 12.5px;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  outline: none;
  cursor: pointer;
}
.filter-select:focus, .filter-date:focus { border-color: var(--border-focus); }
.filter-select.wide { min-width: 180px; }
.filter-date { color-scheme: dark; }
.date-sep { color: var(--text-muted); font-size: 13px; }

/* Topbar: perfil/period/role select */
.role-select-wrap, .period-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.role-select-label { font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.role-select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

/* Notificações */
.notif-panel {
  position: fixed;
  top: 74px;
  right: 330px;
  width: 340px;
  max-height: 440px;
  background: rgba(14, 14, 16, 0.98);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  z-index: 60;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.notif-panel-body { overflow-y: auto; max-height: 360px; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  opacity: 0.55;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:not(.read) { opacity: 1; background: rgba(139, 92, 246, 0.05); }
.notif-icon { flex: none; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.notif-body { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.notif-body strong { font-size: 12.5px; font-weight: 600; }
.notif-body span { color: var(--text-secondary); font-size: 11.5px; }
.notif-body em { color: var(--text-muted); font-size: 10.5px; font-style: normal; font-family: 'JetBrains Mono', monospace; }

/* Tabelas: wrap interno e ações */
.table-wrap { overflow-x: auto; }
.row-actions { display: flex; gap: 4px; align-items: center; }
.btn-row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}
.btn-row:hover { background: rgba(16, 185, 129, 0.12); color: var(--brand-green); }
.btn-row.danger:hover { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.btn-row.approve { background: rgba(16, 185, 129, 0.14); color: var(--brand-green); }
.btn-row.big { width: auto; padding: 0 14px; height: 36px; gap: 6px; font-size: 12.5px; font-weight: 600; border-radius: 8px; }

/* Badges de status/conformidade/auditoria/papel */
.st-paid { background: rgba(16, 185, 129, 0.14); color: var(--brand-green); border: 1px solid rgba(16, 185, 129, 0.3); }
.st-review { background: rgba(59, 130, 246, 0.12); color: var(--brand-blue); border: 1px dashed rgba(59, 130, 246, 0.35); }

.compliance-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.cp-compliant { background: rgba(16, 185, 129, 0.12); color: var(--brand-green); border: 1px solid rgba(16, 185, 129, 0.25); }
.cp-warning { background: rgba(245, 158, 11, 0.12); color: var(--brand-orange); border: 1px solid rgba(245, 158, 11, 0.3); }
.cp-violation { background: rgba(239, 68, 68, 0.12); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.35); }

.audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.au-verified { background: rgba(16, 185, 129, 0.12); color: var(--brand-green); }
.au-review { background: rgba(59, 130, 246, 0.12); color: var(--brand-blue); }
.au-blocked { background: rgba(239, 68, 68, 0.12); color: #ef4444; }

.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.role-owner { background: rgba(245, 158, 11, 0.15); color: var(--brand-orange); }
.role-admin { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.role-finance { background: rgba(16, 185, 129, 0.15); color: var(--brand-green); }
.role-employee { background: rgba(59, 130, 246, 0.15); color: var(--brand-blue); }

/* Paginação */
.pagination { display: flex; align-items: center; gap: 10px; }
.pg-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pg-btn:disabled { opacity: 0.35; cursor: default; }
.pg-info { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-secondary); }

/* Overview grid + side stack */
.overview-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.side-stack { display: flex; flex-direction: column; gap: 20px; }
.activity-card, .risk-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
}
.activity-card .section-header, .risk-card .section-header { padding: 14px 18px; }

.activity-feed { padding: 6px 14px 14px; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
  font-size: 14px;
}
.activity-body { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.activity-body p { margin: 0; }
.activity-detail { color: var(--text-secondary); font-size: 11.5px; }
.activity-time { color: var(--text-muted); font-size: 10.5px; font-family: 'JetBrains Mono', monospace; }
.activity-feed.large { padding: 8px 20px 20px; }

.risk-list { padding: 6px 14px 14px; }
.risk-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 12px; }
.risk-item:last-child { border-bottom: none; }
.risk-item i { font-size: 16px; flex: none; margin-top: 2px; }
.risk-item div { display: flex; flex-direction: column; gap: 1px; }
.risk-item strong { font-size: 12px; }
.risk-item span { color: var(--text-secondary); font-size: 11px; }
.risk-block i { color: #ef4444; }
.risk-review i { color: var(--brand-blue); }
.risk-text { color: var(--brand-orange); font-size: 12.5px; margin: 6px 0 0; }

/* Modais */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: #0e0e10;
  border: 1px solid var(--border-focus);
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.modal-sm { max-width: 460px; }
.modal-lg { max-width: 780px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-subtle);
}
.modal-lead { font-size: 14px; margin-bottom: 14px; color: var(--text-primary); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.field.span-2 { grid-column: span 2; }
.field input, .field select, .field textarea {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand-green); }
.field select { color-scheme: dark; }
.field input[type="date"], .field input[type="number"] { color-scheme: dark; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.detail-row span { color: var(--text-muted); }
.detail-row b { color: var(--text-primary); font-weight: 500; text-align: right; word-break: break-word; }
.ev-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 14px;
}
.ev-card.warn { border-color: rgba(245, 158, 11, 0.3); }
.ev-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Assinatura criptográfica demo */
.sig-box {
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
}
.sig-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 10px;
}
.sig-payload {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 10px;
}
.sig-result { font-size: 11.5px; color: var(--text-secondary); min-height: 18px; margin-bottom: 10px; }
.sig-actions { display: flex; gap: 8px; }
.sig-ok { color: var(--brand-green); font-weight: 700; }
.sig-fail { color: #ef4444; font-weight: 700; }

/* Políticas */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.policy-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.policy-head { display: flex; justify-content: space-between; align-items: center; }
.policy-name { font-size: 15px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.policy-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.sev-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 99px;
}
.sev-block { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.sev-warn { background: rgba(245, 158, 11, 0.12); color: var(--brand-orange); }
.policy-actions { display: flex; gap: 8px; margin-top: 8px; }
.policy-actions .btn-secondary { padding: 6px 10px; font-size: 11.5px; }

/* Relatórios */
.report-meta { padding: 12px 22px; font-size: 11.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; border-bottom: 1px solid rgba(255,255,255,0.03); }

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.analytics-grid .section { grid-column: span 1; }
.analytics-grid .span-2 { grid-column: span 2; }
.analytics-grid .chart-wrapper { min-height: 260px; }

.supplier-bars { padding: 8px 20px 18px; }
.supplier-row { display: grid; grid-template-columns: 160px 1fr 110px; align-items: center; gap: 12px; padding: 8px 0; }
.supplier-name { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.supplier-bar-track { background: rgba(255, 255, 255, 0.05); border-radius: 99px; height: 8px; overflow: hidden; }
.supplier-bar { height: 100%; background: linear-gradient(90deg, #10b981, #8b5cf6); border-radius: 99px; }
.supplier-val { font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 700; text-align: right; }

/* Auditoria */
.audit-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.audit-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}
.chip-verified { background: rgba(16, 185, 129, 0.1); color: var(--brand-green); }
.chip-review { background: rgba(59, 130, 246, 0.1); color: var(--brand-blue); }
.chip-blocked { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.chip-info { background: rgba(139, 92, 246, 0.1); color: #a78bfa; }

/* Geolocalização */
.geo-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.geo-map {
  position: relative;
  background: radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.06), transparent 40%),
              radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.06), transparent 40%),
              linear-gradient(0deg, #0a0a0c, #101014);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  height: 260px;
  margin-bottom: 16px;
  overflow: hidden;
}
.geo-map-lines { position: absolute; inset: 0; }
.geo-svg { width: 100%; height: 100%; }
.geo-dot { stroke: var(--border-focus); stroke-width: 1.5; }
.geo-dot-base { fill: #9ca3af; }
.geo-dot-fuel { fill: var(--brand-orange); }
.geo-dot-toll { fill: var(--brand-purple); }
.geo-dot-rest { fill: var(--brand-blue); }
.geo-dot-stop { fill: var(--brand-green); }
.geo-lbl { fill: #6b7280; font-family: 'JetBrains Mono', monospace; font-size: 4.5px; font-weight: 600; }
.geo-map-label {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 8px;
  border-radius: 6px;
}
.geo-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.geo-stat { display: flex; flex-direction: column; gap: 2px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 12px; }
.geo-stat span { font-size: 10px; color: var(--text-muted); text-transform: uppercase; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.05em; }
.geo-stat strong { font-size: 18px; font-family: 'Space Grotesk', sans-serif; }

.route-points { list-style: none; padding: 10px 20px 20px; margin: 0; }
.route-point {
  display: grid;
  grid-template-columns: 30px 48px 1fr 70px;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}
.route-point:last-child { border-bottom: none; }
.route-point i { font-size: 16px; color: var(--brand-green); }
.rp-time { font-family: 'JetBrains Mono', monospace; color: var(--text-secondary); font-size: 11.5px; }
.rp-km { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.rp-detail { grid-column: 3 / -1; color: var(--text-secondary); font-size: 11.5px; margin-top: -18px; }

/* Price intelligence */
.heat-col { min-width: 90px; }
.heat-bar { height: 8px; background: rgba(255, 255, 255, 0.05); border-radius: 99px; overflow: hidden; width: 90px; }
.heat-fill { height: 100%; background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444); border-radius: 99px; }
.kpi-grid.mini .kpi-value { font-size: 26px; }

/* Toasts */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(17, 17, 19, 0.97);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  max-width: min(460px, 90vw);
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(16, 185, 129, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.55); }
.toast.info { border-color: rgba(139, 92, 246, 0.5); }

/* Impressão: só o relatório */
@media print {
  body.dark-theme { overflow: visible; background: #fff; color: #000; }
  .sidebar, .topbar, .demo-ribbon, .filter-bar, .page-header, .modal-backdrop, #toastRoot,
  .pagination, .header-actions, .permission-note { display: none !important; }
  .app-container { display: block; height: auto; }
  .main-content { overflow: visible; }
  .dashboard-scroll { padding: 0; overflow: visible; }
  .view { display: none !important; }
  #view-reports { display: block !important; }
  .table-section { border: none; }
  .expenses-table { color: #000; }
  .expenses-table th { color: #333; border-bottom: 1px solid #ccc; }
  .expenses-table td { border-bottom: 1px solid #eee; color: #111; }
}

/* Responsividade das novas seções */
@media (max-width: 1024px) {
  .overview-grid, .geo-grid { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-grid .span-2 { grid-column: span 1; }
  .notif-panel { right: 20px; }
  .role-select-wrap .role-select-label { display: none; }
}

@media (max-width: 820px) {
  .period-wrap { display: none; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
  .filter-search { width: 100%; max-width: none; }
  .notif-panel { position: fixed; top: 60px; right: 10px; left: 10px; width: auto; }
  .geo-stats { grid-template-columns: repeat(2, 1fr); }
  .route-point { grid-template-columns: 26px 44px 1fr; }
  .rp-detail { grid-column: 2 / -1; margin-top: 2px; }
  .supplier-row { grid-template-columns: 1fr 90px; }
  .policy-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .kpi-grid.mini { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-select, .filter-date { width: 100%; }
  .header-actions { width: 100%; }
  .header-actions .btn-primary { flex: 1; justify-content: center; }
  .route-point { font-size: 11.5px; }
  .sort-label { display: none; }
}
