:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #65727c;
  --line: #dbe2e6;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warn: #b45309;
  --danger: #b91c1c;
  --bar: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 13px;
  cursor: pointer;
}

button:hover {
  border-color: #a7b3ba;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.dangerButton {
  border-color: var(--danger);
  color: var(--danger);
}

button.dangerButton:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.shell {
  width: min(1240px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 17px;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  margin: 4px 0 0;
}

.actions,
.buttonRow,
.tabs,
.panelHead {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions {
  align-items: center;
}

.timezoneControl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  color: var(--muted);
}

.timezoneControl select {
  min-width: 78px;
}

.panelHead {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tabs {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tab {
  border: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  min-height: 40px;
}

.tab.active {
  background: #e5f3f1;
  color: var(--accent-dark);
  border-bottom: 3px solid var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.facts {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 8px 12px;
  margin: 0 0 14px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 650;
  word-break: break-word;
}

.metricGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 28px;
  letter-spacing: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 650;
  background: #f9fbfb;
}

.linkButton {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 0;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.linkButton:hover {
  border-color: transparent;
  color: var(--accent);
}

.bars {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.barRow {
  display: grid;
  grid-template-columns: 92px 1fr 70px;
  gap: 10px;
  align-items: center;
}

.barTrack {
  height: 14px;
  border-radius: 4px;
  background: #e8eef2;
  overflow: hidden;
}

.barFill {
  height: 100%;
  background: var(--bar);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  border-radius: 8px;
  background: #172026;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.toast.show {
  opacity: 1;
}

.warn {
  color: var(--warn);
}

.danger {
  color: var(--danger);
}

.loginBody {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.loginShell {
  width: min(420px, 100%);
}

.loginPanel {
  padding: 28px;
}

.loginEyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.loginForm {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.loginForm label {
  font-weight: 650;
}

.loginForm input,
.loginForm button {
  width: 100%;
}

.loginError {
  min-height: 20px;
  margin: 2px 0 0;
  color: var(--danger);
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .grid.two,
  .metricGrid {
    grid-template-columns: 1fr;
  }

  .facts {
    grid-template-columns: 1fr;
  }

  .barRow {
    grid-template-columns: 74px 1fr 56px;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 8px 6px;
  }
}
