:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #151b23;
  --muted: #667085;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-ink: #1746a2;
  --accent-soft: #edf4ff;
  --green: #0f8f68;
  --red: #b42318;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
  font-weight: 750;
  line-height: 1.25;
}

h2 {
  font-size: 14px;
  font-weight: 750;
}

.login-screen {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 20px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 420px;
  padding: 22px;
  width: 100%;
}

.login-brand {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.login-status {
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 72px;
  padding: 13px 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #1f7a5d, var(--accent));
  border-radius: 8px;
  color: #ffffff;
  display: flex;
  flex: 0 0 40px;
  font-size: 13px;
  font-weight: 800;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

main {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1480px;
  padding: 18px 24px 32px;
}

button,
input,
select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  min-height: 38px;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 15px;
}

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

button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.secondary-button {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--ink);
  white-space: nowrap;
}

.secondary-button:hover {
  background: #f8fafc;
  color: var(--ink);
}

input,
select {
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  width: 100%;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  outline: none;
}

.filters {
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 11px;
  grid-template-columns: 142px minmax(220px, 1fr) 140px 140px 104px auto;
  padding: 13px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
}

.metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  min-height: 86px;
  padding: 14px;
}

.metrics span,
.meta,
.empty {
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  font-size: 24px;
  font-weight: 780;
  line-height: 1.2;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.split,
.grid-panels {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  min-width: 0;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 45px;
  padding: 12px 14px;
}

.breakdown {
  display: grid;
  gap: 9px;
  padding: 14px;
}

.breakdown-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(80px, 150px) 1fr minmax(36px, auto);
}

.breakdown-row span,
.record strong,
td {
  overflow-wrap: anywhere;
}

.bar {
  background: var(--accent-soft);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.bar span {
  background: var(--accent);
  display: block;
  height: 100%;
  min-width: 2px;
}

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

table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8fafc;
}

td {
  max-width: 280px;
}

.wide {
  grid-column: 1 / -1;
}

.record-list {
  display: grid;
  gap: 9px;
  max-height: 520px;
  overflow: auto;
  padding: 13px 14px 14px;
}

.record {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 11px;
}

.record strong {
  font-size: 13px;
}

.pill {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-ink);
  display: inline-block;
  font-size: 12px;
  font-weight: 750;
  padding: 3px 8px;
  width: fit-content;
}

.empty {
  padding: 8px 0;
}

.error {
  color: var(--red);
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  main {
    padding: 14px 12px 24px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .filters,
  .metrics,
  .split,
  .grid-panels {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  table {
    min-width: 760px;
  }
}
