/* MyMeteo — shared styles.
 *
 * Mobile-first, big targets, one thing per screen — the same brief as the
 * survey renderer (BUILD_PLAN.md §5). Pages may extend these tokens but should
 * not re-declare them: keep the whole app looking like one app.
 */

:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #1b2430;
  --ink-dim: #5b6773;
  --accent: #0b7285;
  --accent-ink: #ffffff;
  --line: #e4e8ec;
  --danger: #c0392b;
  --ok: #1e8e3e;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  padding: 1.25rem 1rem 3rem;
}

main {
  max-width: 30rem;
  margin: 0 auto;
}

h1 { font-size: 1.35rem; letter-spacing: -.01em; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
p  { margin: .4rem 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}

.muted { color: var(--ink-dim); }
.small { font-size: .875rem; }
.center { text-align: center; }

label { display: block; font-weight: 600; margin: 1rem 0 .3rem; font-size: .95rem; }
input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  font: inherit;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: #fff;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: .7rem 1.1rem;
  border-radius: .5rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  margin-top: 1rem;
}
button:disabled { opacity: .55; cursor: not-allowed; }
button + button, .btn + .btn { margin-left: .5rem; }

.error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c0;
  border-radius: .5rem;
  padding: .7rem .9rem;
  margin: .8rem 0;
  font-size: .9rem;
}
.error:empty { display: none; }

.banner {
  background: #eaf6fb;
  color: var(--accent);
  border: 1px solid #bfe0ee;
  border-radius: .5rem;
  padding: .7rem .9rem;
  margin: .8rem 0;
  font-size: .9rem;
}
.banner:empty { display: none; }

.check-row { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0; }
.check-row input { margin-top: .25rem; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { counter-increment: step; padding: .5rem 0 .5rem 2rem; position: relative; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: .55rem;
  width: 1.4rem; height: 1.4rem;
  background: var(--accent); color: #fff;
  border-radius: 50%;
  font-size: .8rem; font-weight: 700;
  display: grid; place-content: center;
}
.steps li.done::before { background: var(--ok); content: "✓"; }

/* ------------------------------------------------------------ procedures page
 * Three procedurally-gated tiles per experiment. A tile is a card row: title +
 * subtitle on the left, one Start button on the right. `.locked` greys the
 * whole tile and hides the button; `.done` turns the left edge green. The
 * left-edge accent is the phase colour, set from the markup. */

.tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: .6rem 0;
  padding: .95rem .9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: .6rem;
}
.tile .tile-body { flex: 1; min-width: 0; }
.tile h3 { margin: 0 0 .15rem; font-size: 1rem; }
.tile .muted { margin: 0; }
.tile .btn { width: auto; flex-shrink: 0; margin: 0; padding: .5rem .95rem; }
.tile.locked { opacity: .55; }
.tile.locked .btn { display: none; }
.tile.done { border-left-color: var(--ok); }
.tile.phase-study { border-left-color: #1a73e8; }
.tile.phase-offboarding { border-left-color: #b8860b; }
.done-tag { display: inline-block; margin-top: .3rem; color: var(--ok); font-weight: 700; font-size: .8rem; }
.exp-group h2 { margin-top: 0; }

/* ------------------------------------------------------------- survey renderer */

.progress-wrap {
  position: sticky; top: 0; z-index: 1;
  height: .35rem;
  background: var(--line);
  border-radius: .5rem;
  margin: .5rem 0 1rem;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: .5rem;
  transition: width .25s ease;
}

.survey-card h1 { font-size: 1.2rem; margin-bottom: .25rem; }
.survey-card h2 { font-size: 1.05rem; margin: 1.4rem 0 .4rem; }

/* 7-point scales: a labelled segmented control, one button per point. An
 * untouched control has no value at all — that is the point. */
.segmented-control { display: flex; gap: .35rem; margin: 1.4rem 0 .4rem; }
.seg-btn {
  flex: 1;
  padding: .75rem 0;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--card);
  color: var(--ink-dim);
  font: inherit; font-weight: 600;
  cursor: pointer;
}
.seg-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.scale-legend {
  display: flex; justify-content: space-between; gap: .5rem;
  color: var(--ink-dim); font-size: .8rem; margin-bottom: 1.2rem;
}
.scale-legend .center { text-align: center; }
.scale-legend .end { text-align: right; }

/* single/multi option lists with exclusive + free-text options. */
.option-group { margin: 1.4rem 0; }
.option-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--card);
  margin: .45rem 0;
  cursor: pointer;
}
.option-row input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.option-row.on { border-color: var(--accent); background: #eef7f9; }
.free-text { display: none; }
.free-text.show { display: block; margin: -.1rem 0 .6rem; }

.boolean-row { display: flex; gap: .6rem; margin: 1.4rem 0; }
.boolean-row button { flex: 1; }
.boolean-row button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.text-answer {
  width: 100%; font: inherit;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  margin-top: 1.2rem;
  background: #fff;
}
textarea.text-answer { resize: vertical; }

.nav-row { display: flex; gap: .6rem; margin: 1rem 0 2rem; }
.nav-row .btn, .nav-row .btn.primary { flex: 1; width: auto; margin: 0; }

.readonly-questions { padding-left: 1.1rem; color: var(--ink-dim); font-size: .9rem; }

/* ------------------------------------------------------------------- /admin */

select {
  width: 100%;
  font: inherit;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: #fff;
}
.roster { width: 100%; border-collapse: collapse; font-size: .9rem; }
.roster th, .roster td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.roster th { color: var(--ink-dim); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.roster .btn { width: auto; margin: 0; padding: .4rem .8rem; font-size: .85rem; }
.roster button.offboard { border-color: #f5c6c0; color: var(--danger); background: #fff; }
.roster button.offboard:hover { background: #fdecea; }
