* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #e85d04;
  --primary-dark: #c44d03;
  --primary-light: #fff3e6;
  --success: #059669;
  --success-light: #d1fae5;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 250px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ====== LOGIN ====== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FACC15 0%, #F97316 100%);
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-img { width: 160px; height: auto; margin-bottom: 8px; }
.login-logo h1 { font-size: 24px; margin-top: 8px; color: var(--gray-900); }
.login-logo p { color: var(--gray-500); font-size: 14px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; }

/* ====== LAYOUT ====== */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.2s;
}
.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header .sidebar-logo { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.sidebar-header i { font-size: 24px; color: #F97316; }
.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 20px;
  cursor: pointer;
  margin-left: auto;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.sidebar-close-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
@media (max-width: 768px) { .sidebar-close-btn { display: flex; } }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active {
  color: #fff;
  background: rgba(249,115,22,0.15);
  border-left-color: #F97316;
}
.nav-item i { width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--gray-400);
}
.sidebar-footer button {
  background: none; border: none;
  color: var(--gray-400); cursor: pointer;
  font-size: 16px; padding: 4px 8px; border-radius: 4px;
}
.sidebar-footer button:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* Main */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px 32px;
  min-height: 100vh;
}

/* ====== COMPONENTS ====== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); }

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.stat-card .icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .icon.green { background: var(--success-light); color: var(--success); }
.stat-card .icon.red { background: var(--danger-light); color: var(--danger); }
.stat-card .icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-card .icon.orange { background: #fff3e6; color: #e85d04; }
.stat-card .info h4 { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-card .info .value { font-size: 24px; font-weight: 700; color: var(--gray-900); }

/* Table */
.table-container {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.table-toolbar h3 { font-size: 16px; font-weight: 600; }
.table-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gray-200);
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}
tr:hover td { background: var(--gray-50); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.btn-ghost { background: none; color: var(--gray-600); padding: 4px 8px; }
.btn-ghost:hover { background: var(--gray-100); transform: none; box-shadow: none; }

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* Form */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.form-row .form-group { margin-bottom: 0; }
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  color: var(--gray-400);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 24px; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 280px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* Section */
.section-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.section-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--gray-800); }

/* Detail list */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.detail-item label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; font-weight: 600; }
.detail-item .val { font-size: 16px; font-weight: 600; color: var(--gray-900); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--gray-400);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 16px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ====== MOBILE HEADER BAR ====== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--gray-900);
  color: #fff;
  z-index: 150;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mobile-header .mobile-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.mobile-header .mobile-toggle:hover { background: rgba(255,255,255,0.1); }
.mobile-header .mobile-header-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-header .mobile-header-title img { height: 28px; width: 28px; border-radius: 6px; }

/* Old toggle (hidden, replaced by header) */
.mobile-toggle-old {
  display: none;
}

/* Responsive */
@media (max-width: 1024px) {
  .main-content { padding: 20px 16px; }
  .cards-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card .info .value { font-size: 20px; }
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }
}

@media (max-width: 768px) {
  /* Prevent horizontal scroll */
  html, body { overflow-x: hidden; max-width: 100vw; }

  /* Mobile header bar */
  .mobile-header { display: flex; }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-header span, .nav-item span, .sidebar-footer span { display: initial; }
  .sidebar-header { justify-content: flex-start; }
  .nav-item { justify-content: flex-start; padding: 14px 20px; border-left: 3px solid transparent; }

  /* Overlay when sidebar open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.show { display: block; }

  .main-content {
    margin-left: 0;
    padding: 68px 10px 20px;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-header h2 { font-size: 18px; }

  .modal { width: 96%; max-width: none; max-height: 92vh; margin: 16px; }
  .modal-header { padding: 16px; }
  .modal-header h3 { font-size: 16px; }
  .modal-body { padding: 16px; }

  .form-row { grid-template-columns: 1fr; gap: 8px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .cards-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-card .icon { width: 36px; height: 36px; font-size: 15px; border-radius: 10px; }
  .stat-card .info .value { font-size: 18px; }
  .stat-card .info h4 { font-size: 10px; }

  /* ====== MOBILE TABLE → CARD VIEW ====== */
  .table-container { overflow: hidden; border-radius: var(--radius); }
  .table-toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
  .table-toolbar h3 { font-size: 15px; }
  .table-filters { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .table-filters select, .table-filters input { flex: 1; min-width: 0; font-size: 13px; height: 36px; }

  .table-container table { width: 100%; }
  .table-container thead { display: none; }
  .table-container tbody { display: flex; flex-direction: column; gap: 1px; }
  .table-container tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 12px;
    gap: 6px 12px;
    border-bottom: 1px solid var(--gray-200);
    align-items: center;
    position: relative;
  }
  .table-container tbody tr:hover td { background: transparent; }
  .table-container tbody td {
    border: none;
    padding: 2px 0;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    white-space: normal;
    word-break: break-word;
  }
  /* First cell = main info, full width bold */
  .table-container tbody td:first-child {
    width: 100%;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
  }
  /* Last cell (actions) to the right */
  .table-container tbody td:last-child {
    margin-left: auto;
  }
  /* data-label mobile support */
  .table-container tbody td[data-label]::before {
    content: attr(data-label) ": ";
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 4px;
  }
  .table-container tbody td:first-child[data-label]::before {
    display: none;
  }
  /* Badges e botões */
  .table-container tbody td .badge { font-size: 10px; }
  .table-container tbody td .btn-sm { padding: 4px 8px; font-size: 11px; }

  th, td { padding: 8px 10px; font-size: 12px; }

  .login-box { width: 92%; padding: 32px 24px; }
  .login-logo .logo-img { width: 120px; }

  .toast { min-width: auto; max-width: 90vw; font-size: 13px; }
  .toast-container { right: 8px; left: 8px; top: 64px; }

  .detail-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .section-card { padding: 14px; margin-bottom: 16px; }
  .section-card h3 { font-size: 14px; margin-bottom: 12px; }

  /* Charts responsive */
  .charts-row { grid-template-columns: 1fr; gap: 12px; }
  .chart-container { padding: 14px; }
  .chart-container h3 { font-size: 14px; margin-bottom: 12px; }
  .chart-container canvas { max-height: 250px; }

  /* Dropdown fixes */
  .dropdown-menu { right: 0; left: auto; }

  /* Empty state */
  .empty-state { padding: 32px 16px; }
  .empty-state i { font-size: 36px; }
  .empty-state p { font-size: 14px; }

  /* Sidebar search */
  .sidebar-search { padding: 10px 12px 0; }
  .search-results { left: 8px; right: 8px; max-height: 60vh; }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; text-align: left; }

  .main-content { padding: 64px 8px 16px; }

  .page-header h2 { font-size: 16px; }
  .page-header .btn { font-size: 12px; padding: 6px 12px; }

  .form-group label { font-size: 12px; }
  .form-group input, .form-group select, .form-group textarea { font-size: 13px; padding: 8px 10px; }

  .modal { margin: 8px; }
  .modal-body { padding: 12px; }
}

/* Dropdown menu */
.dropdown { display: inline-block; position: relative; }
.dropdown-menu a:hover { background: var(--gray-700); }

/* Print styles */
@media print {
  body { background: white !important; color: black !important; }
  .sidebar, .mobile-toggle, .sidebar-overlay, #toast-container, .page-header button,
  .btn, .table-filters, .form-actions, .nav-item { display: none !important; }
  .app { display: block !important; }
  .main-content { margin-left: 0 !important; padding: 10px !important; }
  table { font-size: 12px; }
  th, td { padding: 4px 6px !important; }
}

/* ====== BUSCA GLOBAL ====== */
.sidebar-search { padding: 12px 16px 0; position: relative; }
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1); border-radius: 8px; padding: 8px 12px;
}
.search-input-wrap i { color: var(--gray-400); font-size: 13px; }
.search-input-wrap input {
  background: transparent; border: none; outline: none; color: #fff;
  font-size: 13px; width: 100%; font-family: inherit;
}
.search-input-wrap input::placeholder { color: var(--gray-500); }
.search-results {
  position: absolute; left: 12px; right: 12px; top: 100%;
  background: var(--gray-800); border: 1px solid var(--gray-700);
  border-radius: 8px; max-height: 400px; overflow-y: auto;
  z-index: 500; box-shadow: var(--shadow-lg);
}
.search-results .sr-group { padding: 8px 0; }
.search-results .sr-group-title {
  font-size: 10px; text-transform: uppercase; color: var(--gray-500);
  padding: 4px 12px; font-weight: 600; letter-spacing: 0.5px;
}
.search-results .sr-item {
  display: block; padding: 8px 12px; color: var(--gray-200);
  font-size: 13px; text-decoration: none; cursor: pointer;
  transition: background 0.1s;
}
.search-results .sr-item:hover { background: rgba(255,255,255,0.1); }
.search-results .sr-item small { color: var(--gray-500); }

/* ====== SIDEBAR FOOTER ====== */
.sidebar-footer-left { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.sidebar-footer-actions { display: flex; gap: 4px; }
.sidebar-footer-actions button {
  background: none; border: none; color: var(--gray-400);
  cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 4px;
}
.sidebar-footer-actions button:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ====== CHART CONTAINERS ====== */
.chart-container {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 24px;
}
.chart-container h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: var(--gray-800); }
.charts-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px;
}
@media (max-width: 900px) { .charts-row { grid-template-columns: 1fr; } }

/* ====== BACKUP PAGE ====== */
.backup-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 16px;
}
.backup-card .backup-icon {
  width: 56px; height: 56px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.backup-card .backup-icon.blue { background: #e0f2fe; color: #0284c7; }
.backup-card .backup-icon.green { background: var(--success-light); color: var(--success); }
.backup-card .backup-icon.orange { background: #fff3e6; color: var(--primary); }

/* ====== DARK MODE ====== */
body.dark-mode {
  --gray-50: #1a1a2e;
  --gray-100: #16213e;
  --gray-200: #2a2a4a;
  --gray-300: #3a3a5a;
  --gray-400: #8888aa;
  --gray-500: #9999bb;
  --gray-600: #bbbbdd;
  --gray-700: #ccccee;
  --gray-800: #e0e0f0;
  --gray-900: #f0f0ff;
  --primary-light: #3a2a1e;
  --success-light: #1a3a2a;
  --danger-light: #3a1a1a;
  --warning-light: #3a2a1a;
}
body.dark-mode { background: #0d1117; color: #c9d1d9; }
body.dark-mode .login-screen { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
body.dark-mode .login-box { background: #161b22; border: 1px solid #30363d; }
body.dark-mode .sidebar { background: #010409; border-right: 1px solid #21262d; }
body.dark-mode .stat-card,
body.dark-mode .table-container,
body.dark-mode .section-card,
body.dark-mode .chart-container,
body.dark-mode .backup-card { background: #161b22; border: 1px solid #21262d; }
body.dark-mode th { background: #0d1117; border-color: #21262d; }
body.dark-mode td { border-color: #21262d; }
body.dark-mode tr:hover td { background: #1c2128; }
body.dark-mode .modal { background: #161b22; border: 1px solid #30363d; }
body.dark-mode .modal-header { border-color: #21262d; }
body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea { background: #0d1117; border-color: #30363d; color: #c9d1d9; }
body.dark-mode .form-actions { border-color: #21262d; }
body.dark-mode .table-toolbar { border-color: #21262d; }
body.dark-mode .btn-secondary { background: #21262d; color: #c9d1d9; }
body.dark-mode .btn-ghost { color: #8b949e; }
body.dark-mode .btn-ghost:hover { background: #21262d; }
body.dark-mode .search-input-wrap { background: rgba(255,255,255,0.05); }
body.dark-mode .search-results { background: #161b22; border-color: #30363d; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #30363d; }
body.dark-mode .sidebar-footer { border-color: #21262d; }
body.dark-mode .nav-item.active { background: rgba(249,115,22,0.1); }

/* ====== PAYWALL ====== */
.paywall-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.paywall-box { background: var(--white, #fff); border-radius: 20px; padding: 40px; max-width: 560px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: pwFadeIn 0.4s ease; }
@keyframes pwFadeIn { from { opacity: 0; transform: scale(0.95) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.paywall-header { text-align: center; margin-bottom: 28px; }
.paywall-logo { height: 48px; margin-bottom: 16px; }
.paywall-header h2 { font-size: 24px; font-weight: 800; color: var(--gray-900); margin-bottom: 8px; }
.paywall-header p { font-size: 15px; color: var(--gray-500); }

.pw-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.pw-plan { border: 2px solid var(--gray-200); border-radius: 12px; padding: 20px 16px; text-align: center; cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden; }
.pw-plan:hover { border-color: var(--gray-300); }
.pw-plan-selected { border-color: var(--primary); background: #fff3e0; }
.pw-plan-badge { position: absolute; top: 8px; right: -28px; background: var(--primary); color: #fff; font-size: 9px; font-weight: 700; padding: 2px 32px; transform: rotate(45deg); text-transform: uppercase; letter-spacing: 0.5px; }
.pw-plan-name { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.pw-plan-price { font-size: 15px; color: var(--gray-700); }
.pw-plan-price strong { font-size: 28px; color: var(--primary); }
.pw-plan-price small { font-size: 13px; color: var(--gray-500); }
.pw-plan-detail { font-size: 12px; color: var(--success); font-weight: 600; margin-top: 4px; }

.pw-methods { display: flex; gap: 12px; margin-bottom: 20px; }
.pw-method-btn { flex: 1; padding: 14px; border: 2px solid var(--gray-200); border-radius: 10px; background: var(--white, #fff); font-size: 14px; font-weight: 600; color: var(--gray-700); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; font-family: inherit; }
.pw-method-btn:hover { border-color: var(--primary); color: var(--primary); background: #fff8f0; }
.pw-method-btn i { font-size: 18px; }
.pw-method-pix { background: #e0f7ed; border-color: #b2dfdb; color: #00695c; }
.pw-method-pix:hover { background: #c8e6c9; border-color: #00897b; color: #004d40; }

.pw-form { background: var(--gray-50, #f9fafb); padding: 24px; border-radius: 12px; margin-top: 4px; animation: pwFadeIn 0.3s ease; }
.pw-form h4 { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.pw-form h4 i { color: var(--primary); }
.pw-form .form-group { margin-bottom: 12px; }
.pw-form .form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.pw-form .form-group input { width: 100%; height: 40px; padding: 0 12px; border: 2px solid var(--gray-200); border-radius: 8px; font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s; }
.pw-form .form-group input:focus { border-color: var(--primary); }
.pw-form .mp-field { height: 40px; border: 2px solid var(--gray-200); border-radius: 8px; padding: 0 4px; display: flex; align-items: center; transition: border-color 0.2s; background: #fff; }
.pw-form .mp-field:focus-within { border-color: var(--primary); }
.pw-form .mp-field iframe { width: 100%; height: 100%; border: none; }
.pw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pw-error { padding: 10px 14px; background: #fde8e8; color: var(--danger); border-radius: 8px; font-size: 13px; margin: 12px 0; border-left: 4px solid var(--danger); }
.pw-success { padding: 16px; background: #e8f5e9; color: var(--success); border-radius: 12px; font-size: 15px; font-weight: 600; text-align: center; margin-top: 16px; border-left: 4px solid var(--success); }

.pw-loading { text-align: center; padding: 24px; color: var(--gray-500); font-size: 15px; }
.pw-pix-qr { display: block; max-width: 200px; margin: 0 auto 16px; border-radius: 8px; }
.pw-pix-label { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; text-align: center; }
.pw-pix-copy { display: flex; gap: 8px; margin-bottom: 12px; }
.pw-pix-copy input { flex: 1; height: 40px; padding: 0 12px; border: 2px solid var(--gray-200); border-radius: 8px; font-size: 12px; font-family: monospace; background: #fff; }
.pw-pix-copy button { width: 40px; height: 40px; border: 2px solid var(--gray-200); border-radius: 8px; background: var(--white, #fff); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; color: var(--gray-600); }
.pw-pix-copy button:hover { border-color: var(--primary); color: var(--primary); }
.pw-pix-valor { text-align: center; font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 8px; }
.pw-pix-status { text-align: center; font-size: 13px; color: var(--warning); }

/* Paywall dark mode */
body.dark-mode .paywall-box { background: #161b22; }
body.dark-mode .paywall-header h2 { color: #c9d1d9; }
body.dark-mode .paywall-header p { color: #8b949e; }
body.dark-mode .pw-plan { border-color: #30363d; background: #0d1117; }
body.dark-mode .pw-plan-selected { border-color: var(--primary); background: #2a1a0a; }
body.dark-mode .pw-plan-name { color: #c9d1d9; }
body.dark-mode .pw-plan-price { color: #c9d1d9; }
body.dark-mode .pw-method-btn { background: #0d1117; border-color: #30363d; color: #c9d1d9; }
body.dark-mode .pw-method-btn:hover { border-color: var(--primary); color: var(--primary); background: #1a120a; }
body.dark-mode .pw-method-pix { background: #0a1a14; border-color: #1a3a2a; color: #4ade80; }
body.dark-mode .pw-form { background: #0d1117; }
body.dark-mode .pw-form h4 { color: #c9d1d9; }
body.dark-mode .pw-form .form-group label { color: #8b949e; }
body.dark-mode .pw-form .form-group input { background: #161b22; border-color: #30363d; color: #c9d1d9; }
body.dark-mode .pw-form .mp-field { background: #161b22; border-color: #30363d; }
body.dark-mode .pw-pix-copy input { background: #161b22; border-color: #30363d; color: #c9d1d9; }
body.dark-mode .pw-pix-copy button { background: #161b22; border-color: #30363d; color: #8b949e; }

@media (max-width: 600px) {
  .paywall-box { padding: 24px 16px; }
  .pw-plans { grid-template-columns: 1fr; }
  .pw-methods { flex-direction: column; }
  .pw-row { grid-template-columns: 1fr; }
}
