:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --text: #20242a;
  --muted: #67717e;
  --line: #dfe4ea;
  --accent: #26735b;
  --accent-strong: #185c47;
  --danger: #b64b3e;
  --warning: #9a6a16;
  --shadow: 0 14px 38px rgba(31, 40, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
  padding: 12px 0;
  background: rgba(246, 247, 249, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 800;
}

.brand small,
.muted,
.status,
label,
.row small {
  color: var(--muted);
}

.brand small {
  font-size: 12px;
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(31, 40, 51, 0.05);
}

.nav a {
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav a.active {
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.session {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.session span {
  overflow: hidden;
  max-width: 220px;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

p { line-height: 1.5; }

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover { background: var(--accent-strong); }
button:disabled { cursor: wait; opacity: 0.6; }

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.status {
  min-height: 22px;
  margin: 0 0 16px;
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric .label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 850;
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.metric.positive .value { color: var(--accent); }
.metric.negative .value { color: var(--danger); }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 { margin: 0; }
.section-title a { color: var(--accent-strong); font-weight: 800; font-size: 14px; }

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

.stack {
  display: grid;
  gap: 12px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(38, 115, 91, 0.18);
  border-color: var(--accent);
}

form button {
  width: 100%;
  align-self: end;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.checkbox input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.list.tall {
  max-height: 680px;
  overflow: auto;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row small { display: block; margin-top: 4px; font-size: 12px; line-height: 1.35; }
.amount { font-weight: 850; white-space: nowrap; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.product-name {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-weight: 850;
}

.login-card h1 { font-size: 30px; }
.login-card p { margin-bottom: 0; }

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .session {
    justify-content: flex-start;
  }

  .page-head,
  .row {
    flex-direction: column;
  }

  .metrics,
  .two,
  .three,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric { min-height: 116px; }
  h1 { font-size: 30px; }
}
