/* Treehouse research, admin UI.
   Researcher-flavoured, but in the same family as the participant
   welcome page: pale sky background, canopy green as the brand, warm
   orange accents. No beige anywhere.
*/

:root {
  /* Ink, surfaces, lines */
  --ink: #1F2A2E;
  --ink-soft: #4F5A60;
  --ink-mute: #7A858B;
  --bg: #EAF1F5;          /* pale sky */
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-tint: #F4F9F6;     /* very pale mint for table row hover */
  --line: #D2DDE0;
  --line-soft: #E4ECEF;

  /* Brand: canopy green and treehouse wood orange */
  --brand: #2F8B3A;
  --brand-deep: #1F6F2C;
  --brand-soft: #DBF0E2;
  --accent: #FF922B;
  --accent-deep: #D9701B;
  --accent-soft: #FFE6CE;

  /* Status colours */
  --warn: #B57B00;
  --warn-soft: #FFF3CD;
  --error: #B73C2A;
  --error-soft: #FBEDEA;

  /* Other */
  --sky: #B6E0F2;
  --bark: #8B6B4A;
  --bark-deep: #5C5042;
  --shadow: 0 1px 2px rgba(31,42,46,0.06), 0 8px 24px rgba(31,42,46,0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 90% -10%, #D4EAF2 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #D7EEDE 0%, transparent 60%),
    var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }

h1, h2, h3 { letter-spacing: -0.015em; margin: 0; color: var(--ink); }
h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 800; }
h2 { font-size: clamp(18px, 2.2vw, 22px); font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }

/* ===== layout shell ===== */
.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  box-shadow: 0 1px 0 rgba(31,42,46,0.04);
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--brand-deep);
  text-decoration: none;
}
.topbar .brand svg { width: 32px; height: 32px; display: block; }
.topbar .brand .dot { color: var(--accent); }
.topbar nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.topbar nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
}
.topbar nav a:hover { background: var(--brand-soft); color: var(--brand-deep); }
.topbar nav a.active { background: var(--brand); color: white; }
.topbar .spacer { flex: 1; }
.topbar .who {
  font-size: 13.5px;
  color: var(--ink-mute);
}
.topbar .who strong { color: var(--ink); font-weight: 700; }

.main {
  padding: 28px 22px 60px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 22px;
}
.page-head .sub {
  color: var(--ink-mute);
  font-size: 14.5px;
}

/* ===== cards / grids ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid {
  display: grid;
  gap: 16px;
}
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 100%);
  opacity: 0.85;
}
.stat .label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
.stat .value {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.stat .hint {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-mute);
}
.stat.warn::before { background: var(--warn); }
.stat.warn .value { color: var(--warn); }
.stat.alert::before { background: var(--error); }
.stat.alert .value { color: var(--error); }

/* ===== forms ===== */
form .field {
  margin: 0 0 14px;
}
form label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 6px;
}
form input[type="text"],
form input[type="password"],
form input[type="search"],
form input[type="number"],
form select,
form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-input);
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47,139,58,0.15);
}
form textarea {
  min-height: 120px;
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  min-height: 44px;
  box-shadow: 0 2px 0 var(--brand-deep);
}
button:hover, .btn:hover { background: var(--brand-deep); box-shadow: 0 3px 0 #155A22; }
button:active, .btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--brand-deep); }
button[disabled], .btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  background: transparent;
  color: var(--brand-deep);
  border: 1px solid var(--brand);
  box-shadow: none;
}
.btn-secondary:hover { background: var(--brand-soft); color: var(--brand-deep); box-shadow: none; }

.btn-accent {
  background: var(--accent);
  box-shadow: 0 2px 0 var(--accent-deep);
}
.btn-accent:hover { background: var(--accent-deep); box-shadow: 0 3px 0 #B85A12; }

.btn-danger {
  background: var(--error);
  box-shadow: 0 2px 0 #8A2C20;
}
.btn-danger:hover { background: #8A2C20; box-shadow: 0 3px 0 #6C2218; }

.btn-quiet {
  background: transparent;
  color: var(--ink-mute);
  text-decoration: underline;
  box-shadow: none;
}
.btn-quiet:hover { background: transparent; color: var(--ink); box-shadow: none; }

/* ===== tables ===== */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14.5px;
  box-shadow: var(--shadow);
}
table.data th {
  background: var(--brand-soft);
  text-align: left;
  font-weight: 700;
  color: var(--brand-deep);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  font-size: 12.5px;
  letter-spacing: 0.05em;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--bg-tint); }
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}
.pill.brand { background: var(--brand-soft); color: var(--brand-deep); }
.pill.accent { background: var(--accent-soft); color: var(--accent-deep); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.alert { background: var(--error-soft); color: var(--error); }

/* ===== notices ===== */
.notice {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14.5px;
  margin: 0 0 14px;
}
.notice.info { background: var(--brand-soft); color: var(--brand-deep); border: 1px solid #B5DCBC; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #F3D680; }
.notice.error { background: var(--error-soft); color: var(--error); border: 1px solid #E9B4AA; }

/* ===== login-only style ===== */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(1100px 600px at 80% -10%, #C7E3EE 0%, transparent 60%),
    radial-gradient(900px 500px at -20% 110%, #DCEFE3 0%, transparent 60%),
    radial-gradient(700px 400px at 50% 110%, #FFE2C8 0%, transparent 65%),
    var(--bg);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px 32px 28px;
  width: min(440px, 96vw);
  box-shadow: 0 18px 60px rgba(31,42,46,0.12), 0 2px 0 var(--brand-soft);
  position: relative;
}
.login-card .login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 4px;
}
.login-card .login-logo svg { width: 56px; height: 56px; display: block; }
.login-card .login-logo .wordmark {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brand-deep);
}
.login-card .login-logo .wordmark .dot { color: var(--accent); }
.login-card h1 { font-size: 22px; margin-top: 14px; margin-bottom: 6px; }
.login-card .sub { color: var(--ink-mute); font-size: 14.5px; margin: 0 0 22px; }

/* ===== utility ===== */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--ink-mute); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }
.center { text-align: center; }

/* ===== reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
