* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  background: #0f0f0f;
  color: #e5e7eb;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #111111;
  color: #fff;
  border-bottom: 1px solid #272727;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-toggle {
  background: #1f2937;
  color: #e5e7eb;
  border: 1px solid #334155;
}

.layout {
  padding: 16px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
}

.subnav {
  display: flex;
  gap: 8px;
  padding: 10px 16px 0;
}

.tab-btn {
  background: #181818;
  color: #d1d5db;
  border: 1px solid #2f2f2f;
  padding: 8px 12px;
  border-radius: 8px;
}

.tab-btn.active {
  background: #f5f5f5;
  color: #000;
}

.panel {
  background: #181818;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #2d2d2d;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.chart {
  width: 100%;
  height: 520px;
}

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

.chart-head h3 {
  margin: 0;
}

.chart-download-btn {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.chart-panel {
  min-height: 600px;
  grid-column: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
}

.stats-grid p {
  font-size: 1.9rem;
  font-weight: 700;
  margin: 4px 0 0;
}

.stats-grid h3 {
  color: #93c5fd;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input[type="password"],
input[type="file"],
input[type="date"],
select,
button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
  background: #121212;
  color: #f3f4f6;
}

select[multiple] {
  min-height: 150px;
}

button {
  background: #f5f5f5;
  color: #000;
  cursor: pointer;
}

button:hover {
  opacity: 0.9;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.chip {
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 6px 10px;
  background: #111827;
  color: #e5e7eb;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.muted {
  color: #9ca3af;
  margin: 6px 0;
}

.error {
  color: #b91c1c;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.card {
  width: min(420px, 94vw);
  background: #181818;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #272727;
}

.date-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
}

.table-panel {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid #2f2f2f;
  border-radius: 8px;
}

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

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #2a2a2a;
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #111;
}

body.light-theme {
  background: #f8fafc;
  color: #0f172a;
}

body.light-theme .topbar {
  background: #ffffff;
  color: #0f172a;
  border-bottom: 1px solid #cbd5e1;
}

body.light-theme .panel,
body.light-theme .tab-btn {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

body.light-theme .muted {
  color: #475569;
}

body.light-theme input[type="password"],
body.light-theme input[type="file"],
body.light-theme input[type="date"],
body.light-theme select,
body.light-theme button {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.light-theme .tab-btn.active,
body.light-theme button {
  background: #2563eb;
  color: #ffffff;
}

body.light-theme .theme-toggle {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.light-theme .chip {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.light-theme .stats-grid h3 {
  color: #1d4ed8;
}

@media (max-width: 1024px) {
  .chart-panel {
    grid-column: 1 / -1;
  }
}
