body {
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  margin: 0;
  background: #f4f6f9;
  color: #333;
  transition:
    background 0.3s,
    color 0.3s;
  line-height: 1.5;
}

body.dark-mode {
  background: #1e1e2d;
  color: #ddd;
}

header {
  background: #1f2937;
  color: white;
  padding: 16px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

body.dark-mode header {
  background: #13131f;
}

header span {
  font-size: 20px;
  font-weight: 600;
}

.btn-toggle-mode {
  background: #374151;
  border: none;
  color: white;
  font-size: 18px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s;
}

.btn-toggle-mode:hover {
  background: #4b5563;
  transform: scale(1.05);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 16px 30px 0 30px;
  border-bottom: 2px solid #e2e8f0;
  background: white;
}

.tab-button {
  padding: 10px 18px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 15px;
  font-weight: 500;
  color: #555;
  transition: all 0.2s ease;
}

.tab-button:hover {
  color: #1d4ed8;
}

.tab-button.active {
  color: #1d4ed8;
  border-color: #1d4ed8;
}

body.dark-mode .tab-button {
  color: #aaa;
}

body.dark-mode .tab-button.active {
  color: #63b3ed;
  border-color: #63b3ed;
}

.analytics-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 30px 0 30px;
  font-size: 14px;
  flex-wrap: wrap;
}

.analytics-filters label {
  font-weight: 600;
  color: #374151;
}

body.dark-mode .analytics-filters label {
  color: #cbd5f5;
}

.analytics-filters select {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  background: white;
  color: #1f2937;
}

body.dark-mode .analytics-filters select {
  background: #2f2f3f;
  border-color: #4b5563;
  color: #e5e7eb;
}

.filters-label {
  font-size: 13px;
  color: #6b7280;
  margin-left: auto;
}

body.dark-mode .filters-label {
  color: #9ca3af;
}

main {
  padding: 30px;
  max-width: 1280px;
  margin: auto;
}

.stats {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.card {
  flex: 1;
  min-width: 200px;
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  text-align: center;
  transition:
    transform 0.2s ease,
    background 0.3s,
    color 0.3s;
}

body.dark-mode .card {
  background: #2e2e3c;
}

.card:hover {
  transform: translateY(-4px);
}

.card h2 {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 10px;
}

body.dark-mode .card h2 {
  color: #bbb;
}

.card p {
  font-size: 26px;
  font-weight: bold;
  color: #111;
  margin: 0;
}

body.dark-mode .card p {
  color: #eee;
}

.card-subtitle {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}

body.dark-mode .card-subtitle {
  color: #9ca3af;
}

.card-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  text-align: left;
  font-size: 13px;
  color: #4b5563;
}

.card-list li {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-list li:last-child {
  margin-bottom: 0;
}

.card-list strong {
  font-size: 14px;
  min-width: 32px;
  text-align: right;
  color: #111827;
}

body.dark-mode .card-list {
  color: #d1d5db;
}

body.dark-mode .card-list strong {
  color: #e5e7eb;
}

.chart-section {
  background: white;
  padding: 25px 30px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
  transition:
    background 0.3s,
    color 0.3s;
}

body.dark-mode .chart-section {
  background: #2e2e3c;
}

.chart-container {
  max-width: 760px;
  margin: auto;
  min-height: 320px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.section-title {
  margin-bottom: 20px;
  font-size: 17px;
  font-weight: 600;
  color: #444;
}

body.dark-mode .section-title {
  color: #ddd;
}

.actions {
  text-align: right;
  margin: 20px 0;
}

.btn {
  background: #2563eb;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition:
    background 0.2s,
    transform 0.2s;
}

.btn:hover {
  background: #1e40af;
  transform: scale(1.03);
}

body.dark-mode .btn {
  background: #3b82f6;
}

body.dark-mode .btn:hover {
  background: #2563eb;
}

.small-btn {
  padding: 4px 8px;
  font-size: 12px;
  margin-left: 6px;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-top: 0;
  transition: background 0.3s;
}

body.dark-mode table {
  background: #2e2e3c;
}

th,
td {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
  transition:
    background 0.3s,
    color 0.3s;
}

body.dark-mode th,
body.dark-mode td {
  color: #ddd;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: #444;
}

body.dark-mode th {
  background: #3b3b4d;
  color: #bbb;
}

tr:hover {
  background: #f5f5f5;
}

body.dark-mode tr:hover {
  background: #404057;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #e5e7eb;
  color: #1f2937;
  text-transform: capitalize;
}

.badge-positive {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

.badge-negative {
  background: rgba(239, 68, 68, 0.18);
  color: #b91c1c;
}

body.dark-mode .badge {
  background: #3b3b4d;
  color: #e5e7eb;
}

body.dark-mode .badge-positive {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

body.dark-mode .badge-negative {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.table-section .empty-state {
  padding: 24px 0;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

body.dark-mode .table-section .empty-state {
  color: #a1a1b5;
}

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fff;
  margin: 8% auto;
  padding: 25px;
  border-radius: 10px;
  width: 60%;
  max-width: 800px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.3s;
  transition:
    background 0.3s,
    color 0.3s;
}

body.dark-mode .modal-content {
  background-color: #3b3b4d;
  color: #ddd;
}

.modal-content h3 {
  margin-top: 0;
  font-size: 18px;
  color: #444;
}

body.dark-mode .modal-content h3 {
  color: #eee;
}

.modal-content pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
  background: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  font-size: 14px;
  color: #111;
}

body.dark-mode .modal-content pre {
  background: #2e2e3c;
  color: #ddd;
}

.close {
  color: #aaa;
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  main {
    padding: 24px 16px 60px 16px;
  }

  .stats {
    gap: 16px;
  }

  .chart-container {
    max-width: 100%;
  }

  .analytics-filters {
    padding-left: 16px;
    padding-right: 16px;
    justify-content: flex-start;
  }

  .analytics-filters .filters-label {
    margin-left: 0;
    width: 100%;
  }

  table {
    min-width: 520px;
  }
}
