:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e8edf3;
  --brand: #1e3a8a;
  --brand2: #2563eb;
  --brand-soft: #eff6ff;
  --orange: #ef7f1a;
  --green: #059669;
  --purple: #7c3aed;
  --red: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    Roboto,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 24px 60px;
}

.page-title {
  margin: 6px 2px 18px;
}

.page-title h1 {
  font-size: 21px;
  margin: 0 0 4px;
  color: var(--brand);
  font-weight: 700;
}

.page-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select,
.btn {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-family: inherit;
}

select {
  padding: 0 32px 0 12px;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  appearance: none;
  cursor: pointer;
  min-width: 130px;
  color: var(--ink);
}

.btn {
  padding: 0 15px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.btn:hover {
  border-color: var(--brand2);
  color: var(--brand2);
}

.btn.primary {
  background: var(--brand2);
  color: #fff;
  border-color: var(--brand2);
}

.btn.primary:hover {
  background: #1d4ed8;
  color: #fff;
}

.toolbar .spacer {
  margin-left: auto;
}

.search {
  position: relative;
}

.search input {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0 14px 0 36px;
  font-size: 14px;
  width: 240px;
  font-family: inherit;
  background: #fff;
}

.search input:focus {
  outline: none;
  border-color: var(--brand2);
}

.search svg {
  position: absolute;
  left: 11px;
  top: 11px;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  border-top: 3px solid var(--stat-accent, var(--brand2));
}

.stat .sl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat .sv {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat .sd {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.dash {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.dash.three {
  grid-template-columns: 2fr 1fr 1fr;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.dash .card {
  margin-bottom: 0;
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 4px;
}

.card .sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
}

.chart-box {
  position: relative;
  height: 270px;
}

.tbl-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

tbody tr:hover {
  background: #fafcff;
}

tbody tr.total-row td {
  font-weight: 700;
  background: #f8fafc;
  border-top: 2px solid #cbd5e1;
  color: var(--brand);
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.bar-track {
  width: 84px;
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  flex-shrink: 0;
}

.bar-fill {
  height: 100%;
  background: var(--brand2);
  border-radius: 999px;
}

.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 960px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash,
  .dash.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .wrap {
    padding: 16px 12px 44px;
  }
  .stats {
    grid-template-columns: 1fr;
  }
  .search input {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }
  .toolbar {
    display: none !important;
  }
  .card,
  .stat {
    box-shadow: none;
    break-inside: avoid;
  }
}
