:root {
  --bg: #f7f6f3; --fg: #1c1c1e; --muted: #6a6a70; --line: #dedbd4; --card: #fff; --soft: #f2f0ec;
  --accent: #2f5bd3; --accent-fg: #fff; --accent-bg: #e7edfc; --ok: #1a7f37; --ok-bg: #e3f4e8;
  --warn: #9a5b00; --warn-bg: #fcefd8; --bad: #b42318; --bad-bg: #fde8e6; --no-bg: #ececea;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416; --fg: #ececee; --muted: #a0a0a8; --line: #2f2f35; --card: #1c1c20; --soft: #24242a;
    --accent: #8aa8ff; --accent-fg: #10142a; --accent-bg: #1e2a4a; --ok: #6fd38a; --ok-bg: #14301d;
    --warn: #ffc266; --warn-bg: #3a2a10; --bad: #ff8a80; --bad-bg: #3a1714; --no-bg: #2a2a2e;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--card); }
.bar .logo { font-weight: 700; color: var(--fg); text-decoration: none; }
.bar .who { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.bar form { margin: 0; }
.bar button.linkbutton { display: inline; width: auto; margin: 0; padding: 0; background: none; border: 0;
  color: var(--accent); font: inherit; font-weight: 400; cursor: pointer; }
main { max-width: 640px; margin: 0 auto; padding: 18px 16px 48px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 15px; margin: 22px 0 6px; color: var(--muted); }
.lead { color: var(--muted); margin: 0 0 12px; }
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 8px 12px; }
.messages li.error { background: var(--bad-bg); color: var(--bad); }

label, .label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 14px 0 4px; }
input[type=email], input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; }
textarea { min-height: 160px; line-height: 1.45; }
input.code { letter-spacing: 6px; font-weight: 600; font-size: 20px; }
.button, button[type=submit], button.button { display: block; width: 100%; text-align: center; border: 0;
  border-radius: 9px; padding: 11px; font: inherit; font-weight: 600; margin-top: 16px; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); text-decoration: none; }
.button.first { margin-top: 0; }
.button.secondary, button.secondary { background: var(--card); color: var(--fg); border: 1px solid var(--line); }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--bad); font-size: 14px; }
.helptext, .note { font-size: 14px; color: var(--muted); }

.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg div { flex: 1; display: flex; }
.seg label { flex: 1; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 9px 4px; font-size: 14px; font-weight: 500;
  color: var(--fg); border-right: 1px solid var(--line); cursor: pointer; background: var(--card); }
.seg div:last-child label { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px; background: var(--soft); }
.drop input { width: 100%; }

.row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 12px 0;
  border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.row .t { font-weight: 600; }
.row .m { font-size: 14px; color: var(--muted); }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.go { background: var(--accent-bg); color: var(--accent); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.no { background: var(--no-bg); color: var(--muted); }
.empty { color: var(--muted); padding: 12px 0; }

.timeline { border-left: 2px solid var(--line); margin: 12px 0 0 6px; padding-left: 14px; list-style: none; }
.timeline li { position: relative; margin: 0 0 9px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent); }
.answer { background: var(--soft); border-radius: 10px; padding: 4px 14px; margin-top: 8px; overflow-wrap: anywhere; }
.answer + .answer { margin-top: 10px; }
.answer pre { overflow-x: auto; }
.answer table { border-collapse: collapse; display: block; overflow-x: auto; }
.answer th, .answer td { border: 1px solid var(--line); padding: 4px 6px; }
.quote { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.files { list-style: none; padding: 0; margin: 8px 0 0; }
.files li { margin: 4px 0; }
.files .ic { display: inline-block; font-size: 10px; font-weight: 700; color: var(--bad); background: var(--bad-bg);
  border-radius: 4px; padding: 2px 5px; margin-right: 6px; }
