:root {
  --bg: #0f172a;
  --text: #e2e8f0;
  --card: #1e293b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --muted: #94a3b8;
  --line: #334155;
  --shadow: rgba(0, 0, 0, 0.2);
  --panel-bg: #1e2638;
}

/* Light Theme Overrides */
.theme-light {
  --bg: #f1f5f9;
  --text: #1e293b;
  --card: #ffffff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --muted: #64748b;
  --line: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
  --panel-bg: #f8fafc;
}

/* === BASE === */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0 20px 60px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

h1 {
  font-size: 24px;
  margin: 1.5rem 0 1rem;
}

/* === BUTTONS === */
.btn,
button {
  background: var(--accent);
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px var(--shadow);
  transition: background 0.2s ease;
}

.btn:hover,
button:hover {
  background: var(--accent-hover);
}

.btn-primary {
  background: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
}
.btn-danger:hover {
  background: #d9363b;
}

/* === HEADER === */
header,
.main-header,
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem 1.5rem 1rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* === FILTERS === */
.filters {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1rem;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
}

.filters label {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.filters input,
.filters select {
  margin-top: 4px;
}

/* === FIELDS === */
input,
textarea,
select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  box-sizing: border-box;
  transition: 0.2s;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  background: var(--panel-bg);
  outline: none;
}

/* === STATS / CARDS === */
.stats,
.upcoming {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
}

.card h2 {
  font-size: 15px;
  color: var(--accent);
  margin-bottom: 6px;
}

.card p {
  font-size: 20px;
  font-weight: bold;
  margin: 0;
}

/* === SECTION BLOCKS === */
.section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 40px;
}

.section h2 {
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 1rem;
}

/* === PROGRESS BAR === */
.progress-container {
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
  height: 20px;
  margin-top: 6px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 500;
  text-align: right;
  padding-right: 8px;
  transition: width 0.3s ease;
  width: 0%;
}

/* === TABLE === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  text-align: left;
}

th {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  background: var(--card);
}

td button {
  background: var(--accent);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  border: none;
  margin-right: 6px;
  cursor: pointer;
}

td button:hover {
  background: var(--accent-hover);
}

/* === CHARTS === */
canvas {
  background: var(--card);
  border-radius: 8px;
  padding: 10px;
  margin-top: 30px;
  width: 100% !important;
  max-height: 220px;
}

.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  flex: 1 1 400px;
  box-shadow: 0 0 0 1px var(--line);
  margin-top: 30px;
}

.chart-box h2 {
  font-size: 16px;
  color: var(--accent);
  margin-bottom: 12px;
}

/* === ALERTS === */
.alerts ul {
  list-style: disc;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
}

/* === FOOTER === */
footer {
  margin-top: auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 1rem;
  background: transparent;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .filters {
    flex-direction: column;
  }

  .btn,
  .btn-primary {
    width: 100%;
    text-align: center;
  }

  .stats,
  .upcoming {
    grid-template-columns: 1fr;
  }

  .chart-grid {
    flex-direction: column;
  }
}

