/* BIO 151 Live Lab — shared styles for the student form and the dashboard.
   Mobile-first; reuses the site's color tokens. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1a1f16;
  --muted: #5b6a58;
  --accent: #2e6b3e;
  --accent-ink: #ffffff;
  --border: #dfe5db;
  --card-bg: #f6f8f4;
  --ok-bg: #e4f4e7;
  --ok-fg: #1d5a2c;
  --warn-bg: #fff4d6;
  --warn-fg: #6b4e00;
  --err-bg: #fde8e8;
  --err-fg: #8a1f1f;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14170f;
    --fg: #eef2ea;
    --muted: #a9b6a2;
    --accent: #7fd18f;
    --accent-ink: #0f1a12;
    --border: #2a2f24;
    --card-bg: #1b2016;
    --ok-bg: #1d3524;
    --ok-fg: #b7e8c2;
    --warn-bg: #3d3113;
    --warn-fg: #ffe3a1;
    --err-bg: #3f1d1d;
    --err-fg: #ffb3b3;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 1rem 16px 6rem; }
.wrap.wide { max-width: 1600px; padding-bottom: 2rem; }
header.lab { border-bottom: 1px solid var(--border); }
header.lab .wrap { padding-top: .8rem; padding-bottom: .8rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; }
header.lab .brand { font-weight: 700; text-decoration: none; color: var(--fg); }
header.lab .brand span { color: var(--accent); }
header.lab .sub { color: var(--muted); font-size: .9rem; }
h1 { font-size: 1.45rem; margin: .6rem 0 .25rem; }
h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; }
p.lede { color: var(--muted); margin-top: 0; }
.hidden { display: none !important; }
.card { border: 1px solid var(--border); background: var(--card-bg); border-radius: 10px; padding: .9rem 1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* form controls — big enough for thumbs */
label { display: block; font-weight: 600; margin: .9rem 0 .3rem; }
input[type=text], input[type=password], textarea, select {
  width: 100%; font: inherit; font-size: 1.05rem; padding: .65rem .75rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg);
  min-height: 48px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
button {
  font: inherit; font-size: 1.05rem; font-weight: 600; min-height: 48px; padding: .6rem 1.1rem;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card-bg); color: var(--fg); cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:disabled { opacity: .55; cursor: default; }
button.link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: .25rem .4rem; min-height: 0; font-weight: 500; }
button.danger { border-color: var(--err-fg); color: var(--err-fg); background: transparent; }

.group-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.group-btn { text-align: left; padding: .7rem .8rem; min-height: 64px; display: flex; flex-direction: column; gap: .15rem; }
.group-btn .status { font-weight: 400; font-size: .85rem; color: var(--muted); }
.group-btn.selected { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card-bg)); }
.group-btn .swatch { display: inline-block; width: .8em; height: .8em; border-radius: 3px; margin-right: .4em; vertical-align: -1px; }

.msg { border-radius: 8px; padding: .7rem .9rem; margin: .8rem 0; font-size: .98rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok-fg); }
.msg.warn { background: var(--warn-bg); color: var(--warn-fg); }
.msg.err { background: var(--err-bg); color: var(--err-fg); }

/* readings table */
table.readings { width: 100%; border-collapse: collapse; margin-top: .5rem; }
table.readings th, table.readings td { padding: .35rem .3rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.readings th { font-size: .85rem; color: var(--muted); font-weight: 600; }
table.readings td.x { font-weight: 600; white-space: nowrap; width: 7rem; font-size: 1.05rem; }
table.readings input { font-size: 1.25rem; text-align: right; font-variant-numeric: tabular-nums; }
table.readings input.dirty { border-color: var(--warn-fg); box-shadow: inset 3px 0 0 var(--warn-fg); }
table.readings input.bad { border-color: var(--err-fg); box-shadow: inset 3px 0 0 var(--err-fg); }
table.readings td.when { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* sticky save bar */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--border);
  background: var(--bg); padding: .6rem 16px calc(.6rem + env(safe-area-inset-bottom));
}
.savebar .inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: .8rem; }
.savebar .state { flex: 1; font-size: .95rem; }
.savebar .state.ok { color: var(--ok-fg); }
.savebar .state.warn { color: var(--warn-fg); }
.savebar .state.err { color: var(--err-fg); }

/* dashboard */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: .5rem 0 1rem; }
.toolbar .grow { flex: 1; }
.chart-box { position: relative; height: min(62vh, 760px); min-height: 320px; border: 1px solid var(--border); border-radius: 12px; padding: .75rem; background: var(--card-bg); }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; margin-top: 1rem; }
.status-card { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; background: var(--card-bg); border-left-width: 8px; }
.status-card .name { font-weight: 700; font-size: 1.15rem; }
.status-card .count { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.status-card .when, .status-card .members { color: var(--muted); font-size: .9rem; }
.status-card .bar { height: 6px; border-radius: 3px; background: var(--border); margin-top: .4rem; overflow: hidden; }
.status-card .bar > i { display: block; height: 100%; }
table.grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { border: 1px solid var(--border); padding: .35rem .6rem; text-align: right; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
details.panel { margin-top: 1.5rem; border: 1px solid var(--border); border-radius: 10px; padding: .5rem .9rem; }
details.panel summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.row > * { flex: 1 1 200px; }
.row > button { flex: 0 0 auto; }
.qr-box { text-align: center; }
.qr-box img { width: min(60vw, 420px); background: #fff; padding: 8px; border-radius: 8px; }
.qr-box .url { font-size: 1.2rem; word-break: break-all; }
@media (min-width: 900px) {
  h1 { font-size: 1.9rem; }
  .tv h1 { font-size: 2.3rem; }
}
@media print {
  .savebar, .toolbar, details.panel { display: none; }
}
