:root { --ink: #1a1a1a; --muted: #5f6368; --line: #d9d9d9; --accent: #1f4e79; --bg: #f6f5f2; --err: #b3261e; }
* { box-sizing: border-box; }
body { margin: 0; padding: 16px; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
.card { max-width: 400px; margin: 8vh auto 0; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 24px; }
.brand { margin: 0 0 16px; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.brand a { color: var(--muted); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 16px; }
label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
input { width: 100%; padding: 10px; font: inherit; border: 1px solid #bbb; border-radius: 6px; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { display: block; width: 100%; margin-top: 16px; padding: 11px; font: inherit; font-weight: 600;
  color: #fff; background: var(--accent); border: 1px solid var(--accent); border-radius: 6px; cursor: pointer; }
button.secondary { color: var(--accent); background: #fff; margin-top: 8px; }
a { color: var(--accent); }
.small { color: var(--muted); font-size: 14px; }
.error { color: var(--err); background: #fdecea; padding: 8px 10px; border-radius: 6px; }
.notice { color: #1b5e20; background: #e8f5e9; padding: 8px 10px; border-radius: 6px; }

/* ---------- signed-in layout ---------- */
.topbar { max-width: 760px; margin: 0 auto 16px; display: flex; flex-wrap: wrap; gap: 8px 16px;
  align-items: center; justify-content: space-between; }
.topbar .brand { margin: 0; color: var(--muted); text-decoration: none; font-size: 14px;
  letter-spacing: .04em; text-transform: uppercase; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; font-size: 15px; }
.topbar nav a { text-decoration: none; }
.topbar nav form { margin: 0; }
button.linkbtn { display: inline; width: auto; margin: 0; padding: 0; border: 0; background: none;
  color: var(--accent); font-weight: normal; cursor: pointer; }
.page { max-width: 760px; margin: 0 auto; }
.page h1 { font-size: 24px; }
.he { font-family: "David Libre", "David", "Times New Roman", serif; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.meta { color: var(--muted); font-size: 14px; }

/* ---------- builder ---------- */
.step { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.step h2 { margin: 0 0 10px; font-size: 17px; }
.num { display: inline-block; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff;
  text-align: center; line-height: 24px; font-size: 13px; margin-right: 8px; vertical-align: 1px; }
.opt { font-weight: normal; color: var(--muted); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.row label { display: inline; margin: 0; font-weight: normal; font-size: inherit; }
input.num-in { width: 5em; padding: 7px 8px; text-align: center; }
.hint, .legend { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.legend { font-size: 13px; }
.key-inc { color: #1e6b31; font-weight: 600; }
.key-exc { color: #a33; font-weight: 600; }
.warn { color: #7a4b00; background: #fff6d6; padding: 8px 10px; border-radius: 6px; margin: 10px 0 0; font-size: 14px; }
.note { background: #fff6d6; color: #5a4500; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 6px; }
label.radio { display: inline-flex; gap: 6px; align-items: center; margin-right: 16px; }
label.radio input { width: auto; }

.siman { border-top: 1px solid #eee; }
.siman:first-child { border-top: 0; }
button.siman-title { display: flex; width: 100%; margin: 0; padding: 8px 2px; gap: 8px; align-items: baseline;
  background: none; border: 0; border-radius: 0; color: var(--ink); font-weight: normal; text-align: right; }
button.siman-title .he { font-weight: 700; font-size: 17px; flex: 1; }
.caret { color: var(--muted); width: 1em; }
.siman-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 10px; }
button.chip { display: inline-block; width: auto; margin: 0; padding: 4px 11px; border: 1px solid #999;
  border-radius: 16px; background: #fff; color: var(--ink); font-weight: normal; font-size: 15px;
  font-family: "David Libre", "David", "Times New Roman", serif; min-height: 32px; }
button.chip small { color: #777; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 12px; }
button.chip.used { border-style: dashed; }
button.chip.inc { background: #dff3e3; border-color: #2a8a3e; }
button.chip.exc { background: #f8e3e3; border-color: #a33; color: #a33; text-decoration: line-through; }

.finish { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin: 6px 0 40px; }
.finish input { flex: 1 1 240px; width: auto; }
button.go { display: inline-block; width: auto; margin: 0; padding: 11px 22px; background: var(--ink); border-color: var(--ink); }

/* ---------- saved tests ---------- */
ul.tests { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
ul.tests li { padding: 12px 16px; border-top: 1px solid #eee; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
ul.tests li:first-child { border-top: 0; }
.tname { font-weight: 600; text-decoration: none; flex: 1 1 100%; }
ul.tests .meta { flex: 1 1 auto; }
.actions { display: flex; gap: 14px; font-size: 14px; }
.bigactions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 20px; }
a.btn { display: inline-block; padding: 10px 18px; border-radius: 6px; background: var(--accent); color: #fff;
  text-decoration: none; font-weight: 600; border: 1px solid var(--accent); }
a.btn.secondary { background: #fff; color: var(--accent); }
ol.qlist { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 36px 12px 16px; font-size: 17px; }
ol.qlist li { margin: 4px 0; }
.tag { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 12px;
  color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; }
button.danger { display: inline-block; width: auto; background: #fff; color: var(--err); border-color: var(--err); font-weight: normal; }
