:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a, #1e293b);
  color: #fff;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.sidebar h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.sidebar h1 span {
  color: #60a5fa;
}

.sidebar-subtitle {
  color: #cbd5e1;
  font-size: 14px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

.sidebar-nav a {
  color: #e2e8f0;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: 0.2s ease;
}

.sidebar-nav a:hover {
  background: rgba(96, 165, 250, 0.18);
  color: #fff;
}

.main-content {
  padding: 28px;
}

.topbar,
.form-section,
.dashboard-section,
.charts-section,
.filters-section,
.table-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar h2 {
  font-size: 28px;
  margin-bottom: 6px;
}

.topbar p,
.section-header p {
  color: var(--text-light);
}

.section-header {
  margin-bottom: 18px;
}

.section-header h3 {
  font-size: 22px;
  margin-bottom: 4px;
}

.form-grid,
.filters-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

.field input,
.field select {
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  outline: none;
  transition: 0.2s ease;
  background: #fff;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.action-field {
  justify-content: flex-end;
}

.btn {
  height: 46px;
  border: none;
  border-radius: 12px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #eef2f7;
  color: var(--text);
}

.btn-secondary:hover {
  background: #dde7f1;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn-remove {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-remove:hover {
  background: #fecaca;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.card {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card span {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

.card strong {
  font-size: 24px;
  color: var(--text);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.chart-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  min-height: 360px;
}

.chart-card h4 {
  margin-bottom: 14px;
  font-size: 16px;
}

.chart-wide {
  grid-column: span 2;
  min-height: 380px;
}

.chart-card canvas {
  width: 100% !important;
  height: 280px !important;
}

.chart-wide canvas {
  height: 300px !important;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

thead {
  background: #eff6ff;
}

th,
td {
  padding: 16px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

th {
  color: #1e3a8a;
  font-size: 14px;
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: #f8fafc;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  background: #ecfeff;
  color: #0f766e;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--text-light);
}

@media (max-width: 1280px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .form-grid,
  .filters-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .cards,
  .charts-grid,
  .form-grid,
  .filters-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-wide {
    grid-column: span 2;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 16px;
  }

  .cards,
  .charts-grid,
  .form-grid,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .chart-wide {
    grid-column: span 1;
  }

  .card strong {
    font-size: 20px;
  }
}