:root {
  color-scheme: light;
  --ink: #18221d;
  --muted: #657168;
  --paper: #f4f1e8;
  --card: #fffdf8;
  --line: #d9d3c6;
  --green: #165b42;
  --green-soft: #dcebe2;
  --orange: #d66c2e;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; }
button, input { font: inherit; }

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 64px);
  background: var(--green);
  color: white;
}
.topbar p, .topbar h1 { margin: 0; }
.topbar p { opacity: .72; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.topbar h1 { font-size: clamp(1.35rem, 3vw, 2rem); }
.brand { border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: 9px 13px; text-decoration: none; font-weight: 800; letter-spacing: .08em; }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: clamp(36px, 6vw, 72px) 0; }
.intro { max-width: 760px; }
.intro h2 { margin: 6px 0 14px; font-size: clamp(2rem, 5vw, 4.1rem); line-height: .98; letter-spacing: -.045em; }
.intro > p:last-child { color: var(--muted); font-size: 1.08rem; line-height: 1.6; }
.eyebrow { margin: 0; color: var(--orange); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.status { margin: 32px 0 14px; color: var(--muted); }
.status.is-error { color: #a32525; }

.study-grid { display: grid; gap: 20px; }
.study-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: clamp(22px, 4vw, 38px); box-shadow: 0 18px 48px rgba(36, 44, 38, .07); }
.study-card__head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.study-card h3 { margin: 5px 0 0; font-size: clamp(1.5rem, 4vw, 2.5rem); }
.study-description, .data-state, .media-state { color: var(--muted); }
.pill { padding: 6px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-weight: 700; font-size: .82rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 28px 0; border-block: 1px solid var(--line); }
.metrics div { padding: 18px 16px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.metrics dd { margin: 5px 0 0; font-size: clamp(1.45rem, 4vw, 2.15rem); font-weight: 760; }
.study-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.study-actions a, .study-actions button, .primary, .quiet { border: 1px solid var(--green); border-radius: 999px; padding: 10px 15px; background: transparent; color: var(--green); text-decoration: none; cursor: pointer; }
.study-actions .primary, .primary { background: var(--green); color: white; }
.study-actions button:disabled { opacity: .45; cursor: wait; }
.quiet { border-color: rgba(255,255,255,.6); color: white; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(480px, 100%); margin: 0; padding: clamp(28px, 7vw, 48px); border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: 0 25px 70px rgba(20,35,28,.12); }
.login-shell h1 { margin: 8px 0 12px; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1; }
.login-shell form { display: grid; gap: 10px; margin-top: 28px; }
.login-shell input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: white; }
.login-shell button { justify-self: start; margin-top: 5px; }
.login-state { min-height: 1.5em; color: #a32525; }

@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr; }
  .topbar .quiet { grid-column: 1 / -1; justify-self: start; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .metrics div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
