/* ==========================================================================
   Wonda Enterprise Operations Console (Cloudscape / Stripe Style)
   High-density, utility-first, mission-critical admin architecture
   ========================================================================== */

@import url('themeforge.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Cores de Console Utilitário */
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  --border-light: #f1f5f9;
  --border-base: #cbd5e1;
  --border-dark: #94a3b8;

  --text-main: #0f172a;
  --text-body: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Acentos de Status Rigorosos */
  --brand: #0284c7;
  --brand-hover: #0369a1;
  --brand-subtle: #e0f2fe;

  --emerald: #059669;
  --emerald-subtle: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber: #d97706;
  --amber-subtle: #fffbeb;
  --amber-border: #fde68a;

  --rose: #e11d48;
  --rose-subtle: #fff1f2;
  --rose-border: #fecdd3;

  --slate: #475569;
  --slate-subtle: #f1f5f9;

  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

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

body.admin-body {
  background-color: var(--bg-app);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 12.5px;
  line-height: 1.45;
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

code, .font-mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ==========================================================================
   Sidebar Lateral Compacta & Técnica
   ========================================================================== */
.admin-sidebar {
  width: 265px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-base);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  text-align: left !important;
}

.admin-brand {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px;
  border-bottom: 1px solid var(--border-base);
  background: #ffffff;
  text-align: left !important;
}

.brand-icon-box {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  text-align: left !important;
  align-items: flex-start !important;
}

.brand-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
  text-align: left !important;
}

.brand-badge {
  font-size: 9.5px;
  font-weight: 700;
  color: #475569;
  background: var(--bg-subtle);
  border: 1px solid var(--border-base);
  padding: 1px 5px;
  border-radius: 3px;
  width: fit-content;
  text-transform: uppercase;
  margin-top: 1px;
}

.admin-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
  text-align: left !important;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding: 12px 10px 4px;
  text-align: left !important;
}

.admin-nav-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 8px 12px !important;
  border-radius: var(--radius-sm);
  color: var(--text-body);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
  border: none;
  background: transparent;
  width: 100% !important;
  text-align: left !important;
}

.nav-item-left {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
  gap: 10px;
  flex: 1;
}

.nav-item-left span {
  text-align: left !important;
  white-space: nowrap !important;
}

.nav-icon {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.admin-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.admin-nav-item.active {
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
}

.admin-nav-item.active .nav-icon {
  color: #0f172a;
}

.nav-badge-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.2;
}

.nav-badge-danger {
  background: var(--rose-subtle);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

.nav-badge-neutral {
  background: var(--slate-subtle);
  color: var(--slate);
  border: 1px solid var(--border-base);
}

.admin-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-base);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
}

.user-info-text {
  flex: 1;
  min-width: 0;
}

.user-info-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info-role {
  font-size: 10px;
  color: var(--emerald);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  display: inline-block;
}

.status-dot-amber {
  background: var(--amber);
}

.status-dot-rose {
  background: var(--rose);
}

/* ==========================================================================
   Header Superior Operacional & Telemetria do Servidor
   ========================================================================== */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-base);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 20px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.admin-page-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.telemetry-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-base);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  white-space: nowrap;
}

.telemetry-item strong {
  color: var(--text-main);
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.btn-compact {
  background: #ffffff;
  color: var(--text-body);
  text-decoration: none;
  padding: 8px 16px !important;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-base);
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  cursor: pointer;
  transition: all 0.1s ease;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1.2;
  height: 36px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-compact:hover {
  background: var(--bg-hover);
  border-color: var(--border-dark);
  color: var(--text-main);
}

.btn-compact-primary {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
  font-weight: 700 !important;
}

.btn-compact-primary:hover {
  background: #1e293b !important;
}

/* ==========================================================================
   Faixa de Notificação / Saúde da Conta Operacional
   ========================================================================== */
.account-health-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-base);
  padding: 9px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  white-space: nowrap !important;
  overflow-x: auto;
  gap: 16px;
}

.health-metrics-group {
  display: flex;
  align-items: center;
  gap: 18px;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.health-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  color: var(--text-body);
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  font-size: 11.5px !important;
  line-height: 1.2 !important;
}

.health-pill span,
.health-pill strong {
  white-space: nowrap !important;
  display: inline !important;
}

.health-pill strong {
  font-weight: 700;
}

.account-health-sync {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

/* ==========================================================================
   Área de Conteúdo de Alta Densidade
   ========================================================================== */
.admin-content-area {
  padding: 18px 24px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

/* Painel de Métricas em Grid Denso (5 Métricas Chave - Sem Quebra de Linha) */
.dense-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

@media (max-width: 1200px) {
  .dense-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .dense-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.dense-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  min-width: 0;
}

.dense-metric-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.1px;
  margin-bottom: 4px;
  white-space: nowrap !important;
  overflow: hidden;
}

.dense-metric-header span {
  white-space: nowrap !important;
}

.dense-metric-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap !important;
  gap: 6px;
}

.dense-metric-value {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.2;
  white-space: nowrap !important;
}

.dense-metric-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap !important;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 4px;
}

.dense-metric-sub * {
  white-space: nowrap !important;
}

/* ==========================================================================
   Tabelas Operacionais de Alta Densidade (Cloudscape/Stripe)
   ========================================================================== */
.dense-table-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  overflow: hidden;
}

.dense-table-toolbar {
  padding: 8px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.toolbar-counter {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-base);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-weight: 600;
}

.toolbar-search {
  background: var(--bg-subtle);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 11.5px;
  color: var(--text-main);
  width: 220px;
  outline: none;
}

.toolbar-search:focus {
  border-color: #0f172a;
  background: #ffffff;
}

.toolbar-select {
  background: var(--bg-subtle);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11.5px;
  color: var(--text-body);
  outline: none;
}

.table-scroll-x {
  overflow-x: auto;
  width: 100%;
  scrollbar-width: thin;
}

.dense-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 11.5px;
  table-layout: auto;
}

.dense-table th {
  background: #f8fafc;
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border-base);
  border-top: none;
  white-space: nowrap;
}

.dense-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-body);
  vertical-align: middle;
  line-height: 1.35;
}

.dense-table th.col-center,
.dense-table td.col-center {
  text-align: center;
}

.dense-table th.col-right,
.dense-table td.col-right {
  text-align: right;
}

.dense-table th.col-left,
.dense-table td.col-left {
  text-align: left;
}

.nowrap {
  white-space: nowrap !important;
}

.text-center {
  text-align: center !important;
}

.text-right {
  text-align: right !important;
}

.text-left {
  text-align: left !important;
}

.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.dense-table tr:hover td {
  background: #f8fafc;
}

/* Status Pills Técnicos */
.tech-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.tech-pill-success {
  background: var(--emerald-subtle);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.tech-pill-warning {
  background: var(--amber-subtle);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.tech-pill-danger {
  background: var(--rose-subtle);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

.tech-pill-neutral {
  background: var(--slate-subtle);
  color: var(--slate);
  border: 1px solid var(--border-base);
}

/* Botões de Ação na Tabela */
.btn-action-dense {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-base);
  background: #ffffff;
  color: var(--text-body);
  transition: all 0.1s ease;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  line-height: 1.2;
}

.btn-action-dense:hover {
  background: var(--bg-hover);
  border-color: var(--border-dark);
}

.btn-action-approve {
  background: var(--emerald-subtle);
  color: var(--emerald);
  border-color: var(--emerald-border);
}

.btn-action-approve:hover {
  background: #d1fae5;
}

.btn-action-reject {
  background: var(--rose-subtle);
  color: var(--rose);
  border-color: var(--rose-border);
}

.btn-action-reject:hover {
  background: #ffe4e6;
}

/* Split Ledger Box (Livro-Razão Contábil) */
.ledger-row-entry {
  display: grid;
  grid-template-columns: 140px 100px 1fr 100px 100px 120px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 11.5px;
  align-items: center;
}

.ledger-header {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  border-bottom: 1px solid var(--border-base);
}

/* Modais de Auditoria e Inspeção */
.admin-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}

.admin-modal-overlay.active {
  display: flex;
}

.admin-modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-base);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
}

.admin-modal-header {
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-modal-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.admin-modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
}

.admin-modal-body {
  padding: 18px;
}

.admin-modal-footer {
  padding: 10px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--border-base);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1400px) {
  .telemetry-node {
    display: none !important;
  }
}

@media (max-width: 1250px) {
  .telemetry-strip {
    display: none !important;
  }
}

.admin-nav-link{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border-radius:var(--radius-sm);color:var(--text-body);text-decoration:none;font-size:12.5px;font-weight:600;width:100%;box-sizing:border-box}
.admin-nav-link:hover{background:#f1f5f9}
