:root {
  --bg: #eceae4;
  --chrome: #f8f7f3;
  --paper: #fffefb;
  --ink: #1f2430;
  --muted: #667085;
  --line: #d9d6cc;
  --accent: #b4432f;
  --accent-ink: #fff;
  --focus: #2f5bd3;
  --ok: #2b8a3e;
  --warn: #b7791f;
  --bad: #c92a2a;
  --hl: #fff3bf;
  --hl-active: #ffe066;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 28px rgb(0 0 0 / .08);
  --radius: 8px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c; --chrome: #1d2027; --paper: #23262e; --ink: #e6e3dc; --muted: #9aa0ad; --line: #353945;
    --accent: #e0674f; --focus: #7aa2ff; --hl: #5a4a12; --hl-active: #7c6415;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 28px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 6px 12px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
button.small { padding: 3px 9px; font-size: 13px; }
button.block { width: 100%; margin-bottom: 10px; }
button.big { padding: 10px 20px; font-size: 16px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input, textarea, select {
  border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 7px 10px; width: 100%;
}
textarea { resize: vertical; min-height: 34px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin: 10px 0; }
label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-size: 14px; }
label.check input { width: auto; margin-top: 3px; }
.mono { font-family: var(--mono); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 16px 8px; }
kbd { font: 11px var(--mono); color: var(--muted); margin-left: auto; }
.print-only { display: none; }

/* dialogs, toasts, banners */
.dlg { border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px 18px; width: min(440px, calc(100vw - 32px)); background: var(--chrome); color: var(--ink); box-shadow: var(--shadow); }
.dlg.wide { width: min(760px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgb(20 22 28 / .45); backdrop-filter: blur(2px); }
.dlg h2 { margin: 0 0 8px; font-size: 18px; }
.dlg p { margin: 6px 0; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.form-error { color: var(--bad); font-size: 14px; }
.row { display: flex; gap: 8px; }
.tips { padding-left: 18px; color: var(--muted); font-size: 14px; }
.tips li { margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 100; transition: opacity .3s; max-width: calc(100vw - 32px); }
.toast.out { opacity: 0; }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--bad) 14%, var(--chrome)); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); padding: 8px 14px; margin: 8px 16px 0; border-radius: var(--radius); }

/* home */
.home-main { max-width: 760px; margin: 0 auto; padding: 48px 16px; }
.home-head { display: flex; gap: 16px; align-items: flex-start; }
.home-head h1 { margin: 0; font: 600 30px/1.1 var(--serif); }
.home-head p { margin: 6px 0 0; color: var(--muted); }
.home-actions { display: flex; gap: 16px; align-items: center; margin: 32px 0; flex-wrap: wrap; }
.open-form { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.home-main h2 { font-size: 15px; margin: 24px 0 8px; }
.home-main h2 small { color: var(--muted); font-weight: 400; }
#recents { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 0; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: 0; }
.doc-link { flex: 1; display: flex; flex-direction: column; padding: 10px 16px; color: inherit; text-decoration: none; min-width: 0; }
.doc-link:hover .doc-title { text-decoration: underline; }
.doc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 13px; color: var(--muted); }
.doc-row.gone { opacity: .55; }
.home-foot { margin-top: 32px; color: var(--muted); font-size: 13px; }
.fatal { display: grid; place-items: center; padding: 16px; }
.fatal-box { max-width: 460px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.fatal-box h1 { margin-top: 0; font: 600 22px var(--serif); }
a.button { display: inline-block; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 6px; text-decoration: none; }

/* doc chrome */
body.doc { display: grid; grid-template-rows: auto auto auto 1fr auto; height: 100vh; overflow: hidden; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--chrome); border-bottom: 1px solid var(--line); }
.brand { display: flex; }
.title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#title { border-color: transparent; background: transparent; font-size: 17px; font-weight: 600; padding: 2px 6px; }
#title:hover, #title:focus { border-color: var(--line); background: var(--paper); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); padding-left: 7px; }
.status svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.status.ok svg { color: var(--ok); }
.status.wait svg { color: var(--warn); }
.status.bad { color: var(--bad); }
.people { display: flex; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 700; font-size: 13px; border: 2px solid var(--chrome); margin-left: -6px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: var(--chrome); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; min-width: 270px; }
.menu button { display: flex; width: 100%; border: 0; background: transparent; text-align: left; padding: 7px 10px; gap: 12px; }
.menu button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

.toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 12px; background: var(--chrome); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tool { border: 1px solid transparent; background: transparent; padding: 5px; width: 32px; height: 32px; display: grid; place-items: center; flex: none; }
.tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 7%, transparent); border-color: transparent; }
.tool.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.tool.text { width: auto; display: flex; gap: 6px; padding: 5px 10px; }
.style-select { width: 140px; padding: 4px 8px; flex: none; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: none; }
.grow { flex: 1; }

.workspace { display: grid; grid-template-columns: 1fr 320px; min-height: 0; }
body.side-hidden .workspace { grid-template-columns: 1fr 0; }
body.side-hidden .side { display: none; }
.canvas { overflow-y: auto; padding: 32px 16px 80px; }
.paper { position: relative; max-width: 816px; min-height: 1056px; margin: 0 auto; background: var(--paper); box-shadow: var(--shadow); padding: 96px; border-radius: 2px; }
/* Letter pages: 1056px sheets (11in at 96dpi) with a 28px gap, drawn behind the text */
.paper.paged { width: 816px; max-width: none; box-shadow: none; border-radius: 0;
  background: repeating-linear-gradient(to bottom, var(--paper) 0 1056px, var(--bg) 1056px 1084px);
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / .08)) drop-shadow(0 6px 16px rgb(0 0 0 / .08)); }
.paper.paged .tiptap { min-height: 864px; }
.page-numbers { position: absolute; inset: 0; pointer-events: none; }
.page-numbers span { position: absolute; left: 0; right: 0; text-align: center; font: 12px var(--sans); color: var(--muted); }
.paper:not(.paged) .page-numbers { display: none; }
.tiptap .page-break { height: 0; border-top: 2px dashed var(--line); margin: 18px 0; position: relative; cursor: default; }
.tiptap .page-break::after { content: 'Page break'; position: absolute; left: 50%; top: -10px; transform: translateX(-50%); background: var(--paper); color: var(--muted); font: 11px var(--sans); padding: 0 8px; }
.tiptap .page-break.ProseMirror-selectednode { border-top-color: var(--focus); }
.bottom { display: flex; justify-content: space-between; gap: 12px; padding: 4px 14px; font-size: 12px; color: var(--muted); background: var(--chrome); border-top: 1px solid var(--line); }

/* the document */
.tiptap { outline: none; font: 16px/1.6 var(--serif); min-height: 800px; caret-color: var(--ink); }
.tiptap > * + * { margin-top: .75em; }
.tiptap p { margin: 0; }
.tiptap h1, .tiptap h2, .tiptap h3 { font-family: var(--sans); line-height: 1.25; margin: 1.4em 0 .4em; }
.tiptap h1 { font-size: 28px; }
.tiptap h2 { font-size: 22px; }
.tiptap h3 { font-size: 18px; }
.tiptap ul, .tiptap ol { padding-left: 1.6em; margin: .5em 0; }
.tiptap li > p { margin: .15em 0; }
.tiptap blockquote { border-left: 3px solid var(--line); margin-left: 0; padding-left: 1em; color: var(--muted); font-style: italic; }
.tiptap pre { background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 6px; padding: 12px 14px; font: 14px/1.5 var(--mono); white-space: pre-wrap; }
.tiptap code { font: .88em var(--mono); background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 4px; border-radius: 4px; }
.tiptap pre code { background: none; padding: 0; }
.tiptap hr { border: 0; border-top: 1px solid var(--line); margin: 1.5em 0; }
.tiptap a { color: var(--focus); }
.tiptap p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--muted); float: left; height: 0; pointer-events: none; }
.tiptap span.comment { background: var(--hl); border-bottom: 2px solid color-mix(in srgb, var(--warn) 60%, transparent); cursor: pointer; }
.tiptap span.comment.active { background: var(--hl-active); }
.collaboration-carets__caret { position: relative; margin: 0 -1px; border-left: 1px solid; border-right: 1px solid; word-break: normal; pointer-events: none; }
.collaboration-carets__label { position: absolute; top: -1.4em; left: -1px; font: 600 11px/1 var(--sans); padding: 3px 5px; border-radius: 3px 3px 3px 0; color: #fff; white-space: nowrap; user-select: none; }
.preview { min-height: 0; max-height: 60vh; overflow: auto; padding: 32px 40px; box-shadow: none; border: 1px solid var(--line); }
.preview .tiptap { min-height: 0; }
.preview-title { font: 600 24px var(--sans); margin: 0 0 16px; }

/* side panel */
.side { border-left: 1px solid var(--line); background: var(--chrome); display: flex; flex-direction: column; min-height: 0; }
.side-tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); }
.side-tabs [role=tab] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 6px 10px; color: var(--muted); }
.side-tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
#side-toggle { margin-left: auto; font-size: 18px; line-height: 1; }
.pill { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; }
.pill:empty { display: none; }
.panel { overflow-y: auto; padding: 12px; flex: 1; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; cursor: pointer; }
.card.active { border-color: var(--warn); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 25%, transparent); }
.card.composing { cursor: default; border-color: var(--focus); }
.card.resolved { opacity: .7; }
.card.orphan blockquote { text-decoration: line-through; }
.card blockquote { margin: 0 0 8px; padding-left: 8px; border-left: 3px solid var(--hl-active); color: var(--muted); font-size: 13px; }
.card .body { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.who { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.who time { color: var(--muted); font-size: 12px; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.reply { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.card textarea { font-size: 14px; margin-top: 4px; }
.card-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.version { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; margin-bottom: 6px; background: var(--paper); }
.version span { font-size: 12px; color: var(--muted); }
.version.auto b { font-weight: 500; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .side { position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 90vw); z-index: 30; box-shadow: var(--shadow); }
  body:not(.side-open) .side { display: none; }
  .paper { padding: 36px 24px; min-height: 0; }
  .canvas { padding: 12px 8px 60px; }
  .people, .bottom span:last-child { display: none; }
}

@media print {
  @page { size: letter; margin: 1in; }
  body.doc { display: block; height: auto; overflow: visible; background: #fff; color: #000; }
  .top, .toolbar, .side, .bottom, #banners, .collaboration-carets__caret { display: none !important; }
  .workspace { display: block; }
  .canvas { padding: 0; overflow: visible; }
  .paper, .paper.paged { box-shadow: none; filter: none; padding: 0; width: auto; max-width: none; min-height: 0 !important; background: #fff; }
  .page-numbers { display: none; }
  .tiptap [data-push] { padding-top: 0 !important; }
  .tiptap .page-break { break-after: page; border: 0; margin: 0; }
  .tiptap .page-break::after { display: none; }
  .print-only { display: block; font: 600 26px var(--sans); margin: 0 0 18px; }
  .print-only:empty { display: none; }
  .tiptap { min-height: 0; color: #000; }
  .tiptap span.comment { background: none; border: 0; }
}

/* help */
.help-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; font-weight: 700; }
.help-link { background: none; border: 0; padding: 0; color: var(--focus); text-decoration: underline; text-underline-offset: 3px; }
.help { display: grid; grid-template-columns: 190px 1fr; grid-template-rows: minmax(0, 1fr); gap: 20px; height: min(66vh, 720px); }
.help-toc { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; border-right: 1px solid var(--line); padding-right: 10px; }
.help-toc a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 5px 8px; border-radius: 6px; }
.help-toc a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.help-sections { position: relative; overflow-y: auto; min-height: 0; padding-right: 6px; scroll-behavior: smooth; }
.help section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); scroll-margin-top: 4px; }
.help section:last-child { border-bottom: 0; }
.help h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 8px; }
.help h4 { font-size: 13px; margin: 0 0 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.help p, .help li, .help dd { font-size: 14.5px; line-height: 1.55; }
.help ul { padding-left: 20px; margin: 6px 0; }
.help li { margin: 5px 0; }
.help code { font: 13px var(--mono); background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 5px; border-radius: 4px; }
.help-icon { width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.help-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.help-status dt { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-top: 8px; }
.help-status dd { margin: 2px 0 0 18px; color: var(--ink); }
.sdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sdot.ok { background: var(--ok); } .sdot.wait { background: var(--warn); } .sdot.bad { background: var(--bad); }
.help-keys { border-collapse: collapse; width: 100%; font-size: 14px; }
.help-keys td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.help-keys td:first-child { width: 42%; }
.keys { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.keys kbd, .help kbd { font: 12px var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; margin: 0; }
@media (max-width: 700px) {
  .help { grid-template-columns: 1fr; height: 68vh; }
  .help-toc { display: none; }
  .help-cols { grid-template-columns: 1fr; }
}

/* sign-in: big and calm, in the reference's palette (docs/refs/MOCK-desk); the other plain
   pages (home, people and devices) share it */
body.signin, body.plain {
  --s-paper: #fbfaf7; --s-ink: #1e2226; --s-muted: #6f7780; --s-line: #e4e6ea; --s-blue: #5b8db8; --s-blue-ink: #2f5f88;
  --s-serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  margin: 0; min-height: 100vh; background: var(--s-paper); color: var(--s-ink);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
}
.signin-main { max-width: 440px; margin: 0 auto; padding: 12vh 24px 48px; display: flex; flex-direction: column; }
.signin-main section, .signin-form { display: flex; flex-direction: column; gap: 12px; }
.signin-brand { font-family: var(--s-serif); font-size: 22px; margin: 0 0 28px; }
.signin-brand i { color: var(--s-blue); font-style: normal; }
.signin-main h1 { font-family: var(--s-serif); font-weight: 400; font-size: 34px; margin: 0 0 24px; }
.signin-primary {
  font: 500 19px/1.2 inherit; color: #fff; background: var(--s-ink); border: 0; border-radius: 12px;
  padding: 18px 20px; cursor: pointer; width: 100%;
}
.signin-primary:disabled { opacity: .55; cursor: default; }
.signin-quiet { font: inherit; font-size: 16px; color: var(--s-blue-ink); background: none; border: 0; padding: 8px 0; cursor: pointer; align-self: center; }
.signin-note { color: var(--s-muted); font-size: 15px; margin: 0; }
.signin-form label { font-size: 15px; color: var(--s-muted); }
.signin-form input { font: inherit; font-size: 19px; padding: 14px 16px; border: 1px solid var(--s-line); border-radius: 12px; background: #fff; color: var(--s-ink); }
.signin-code { letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.signin-msg { margin: 20px 0 0; padding: 12px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--s-line); font-size: 15px; }
.signin-foot { margin: 40px 0 0; font-size: 13px; color: var(--s-muted); }

/* the plain pages: home (Kevin's first screen) and people and devices */
.plain-main { max-width: 640px; margin: 0 auto; padding: 10vh 24px 56px; }
.plain-brand { font-family: var(--s-serif); font-size: 22px; margin: 0 0 32px; }
.plain-brand a { color: inherit; text-decoration: none; }
.plain-brand i { color: var(--s-blue); font-style: normal; }
body.plain h1 { font-family: var(--s-serif); font-weight: 400; font-size: 34px; line-height: 1.2; margin: 0 0 12px; }
body.plain h2 { font-family: var(--s-serif); font-weight: 400; font-size: 21px; margin: 0 0 10px; }
.plain-lede { color: var(--s-muted); font-size: 17px; margin: 0 0 28px; max-width: 34em; }
body.plain .signin-primary { width: auto; padding: 16px 30px; }
body.plain .linky { font: inherit; color: var(--s-blue-ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.plain-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--s-line); }
.plain-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 14px 0; border-bottom: 1px solid var(--s-line); }
.plain-list li > a:first-child { font-family: var(--s-serif); font-size: 20px; color: var(--s-ink); text-decoration: none; }
.plain-list li > span { color: var(--s-muted); font-size: 14px; }
.plain-list .aside { margin-left: auto; font-size: 14px; color: var(--s-blue-ink); }
.plain-foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--s-line); font-size: 13px; color: var(--s-muted); }
.plain-foot p { margin: 4px 0; }

/* the older room styles, in the plain pages' palette */
body.plain {
  --bg: var(--s-paper); --chrome: var(--s-paper); --paper: #fff; --ink: var(--s-ink); --muted: var(--s-muted); --line: var(--s-line);
  --accent: var(--s-ink); --accent-ink: #fff; --focus: var(--s-blue); --ok: #3f7d5a; --warn: #a8701f; --bad: #a33a2b;
  --radius: 12px; --serif: var(--s-serif); color-scheme: light;
}
body.plain button { border-radius: 30px; padding: 6px 14px; }
body.plain button.small { padding: 4px 11px; font-size: 13px; }
body.plain .signin-primary { border-radius: 12px; padding: 16px 30px; font-size: 18px; font-weight: 500; }
body.plain input, body.plain select { border-radius: 10px; padding: 8px 12px; background: #fff; }
body.plain .room-section { background: #fff; border: 1px solid var(--s-line); border-radius: 14px; padding: 4px 22px 18px; margin: 0 0 16px; }
body.plain .section-head { margin: 16px 0 10px; }
body.plain details.room-section summary { margin: 16px 0 6px; }
body.plain .person { background: transparent; border: 0; border-top: 1px solid var(--s-line); border-radius: 0; padding: 14px 0 6px; margin: 0; }
body.plain .device { border-top-style: solid; }
body.plain .pill { border-radius: 30px; padding: 2px 9px; font-size: 12px; }
body.plain .pill:not(.ok):not(.warn) { background: #eef2f6; color: var(--s-muted); }
body.plain .pill.ok { background: #e3f0e7; color: #2f6b45; }
body.plain .pill.warn { background: #f6ead8; color: #8a5a1f; }
body.plain .phrase.big { font-size: 30px; background: #fff; border: 1px solid var(--s-line); padding: 24px 12px; margin: 22px 0 4px; }
body.plain .waiting-screen { max-width: 34em; }
body.plain .waiting-screen .fp { text-align: center; color: var(--s-muted); margin: 0 0 18px; font-size: 12px; font-weight: 500; }
body.plain .danger-zone { border-top: 0; margin-top: 8px; }
body.plain .device-line { margin-top: 28px; }
body.plain .person-head small.login { color: var(--s-muted); font-weight: 400; font-size: 13px; }

/* ---------------------------------------------------------------- rooms */
.marking {
  background: var(--bad); color: #fff; text-align: center; font: 600 12px/1 var(--sans);
  letter-spacing: .08em; text-transform: uppercase; padding: 6px 12px;
}
.room-sub { font-size: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 8px; }
.section-head h2 { margin: 0; }
.home-rooms .section-head { margin-top: 32px; }
.room-section { margin: 0 0 8px; }
details.room-section summary { cursor: pointer; list-style: none; margin: 28px 0 8px; }
details.room-section summary::-webkit-details-marker { display: none; }
details.room-section summary h2 { display: inline; }
details.room-section summary::after { content: ' ▸'; color: var(--muted); }
details.room-section[open] summary::after { content: ' ▾'; }
.doc-list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
#rooms, #recents { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
#rooms:has(> .empty), #recents:has(> .empty) { background: none; border: 0; }
.pill.ok { background: var(--ok); }
.pill.warn { background: var(--warn); }
.pill:not(.ok):not(.warn) { background: color-mix(in srgb, var(--ink) 55%, transparent); }
.section-head .pill { font-size: 12px; padding: 2px 8px; }
.fp { font: 600 13px var(--mono); letter-spacing: .04em; }
.fp.big { font-size: 22px; text-align: center; margin: 14px 0; }
.badge-card { cursor: default; max-width: 520px; margin: 24px 0; padding: 18px 20px; }
.read-in { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.read-in input { flex: 1 1 240px; width: auto; }
.read-in select, .person-actions select { width: auto; }
select { border: 1px solid var(--line); background: var(--paper); color: inherit; border-radius: 6px; padding: 6px 8px; font: inherit; }
.person { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.person-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.person-head b { overflow-wrap: anywhere; }
.person-actions { display: flex; gap: 6px; align-items: center; }
.devices { list-style: none; margin: 8px 0 0; padding: 0; }
.device { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px dashed var(--line); }
.device .hint { flex: 1; margin: 0; }
.device.pending .fp { color: var(--warn); }
.log { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); max-height: 360px; overflow-y: auto; }
.log-row { display: flex; gap: 12px; padding: 7px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.log-row:first-child { border-top: 0; }
.log-row time { color: var(--muted); white-space: nowrap; font-size: 13px; min-width: 150px; }
.danger-zone { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.device-line { margin-top: 24px; }
.fatal-box.inline { margin: 24px 0; }
.fatal-box.inline h2 { margin-top: 0; font: 600 20px var(--serif); }
.room-label { font-size: 12px; color: var(--muted); text-decoration: none; padding-left: 7px; }
.room-label:hover { text-decoration: underline; }
body.doc #banners .marking { margin: 0; }
body.role-viewer .toolbar, body.role-commenter .toolbar > :not(.text):not(.grow) { display: none; }
.print-block { display: none; }
@media (max-width: 560px) {
  .log-row { flex-direction: column; gap: 2px; }
  .person-head { align-items: flex-start; }
}
@media print {
  body.no-print > * { display: none !important; }
  body.no-print .print-block { display: block !important; font: 16px var(--sans); padding: 2cm; }
  body.in-room .marking { display: block; background: none; color: #000; border: 1px solid #000; margin-bottom: 12px; }
}

label.check input[type=radio], label.check input[type=checkbox] { width: auto; flex: none; margin-top: 3px; }

/* ---------------------------------------------------------------- guards */
body.away > *:not(dialog):not(.wm-invisible) { filter: blur(14px); transition: filter .15s; }
body.away::after { content: 'Hidden while this window isn’t in focus'; position: fixed; inset: 0; display: grid; place-items: center; font: 600 18px var(--sans); color: var(--muted); z-index: 2147482000; pointer-events: none; }
@media print { .wm-invisible { display: none; } }
.guard-settings .check { margin: 8px 0; }
.trace-out { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }

/* badge code as six words (hex stays beneath, small) */
.phrase { font-family: var(--serif); font-size: 15px; display: inline-flex; flex-direction: column; gap: 1px; }
.phrase small.fp { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.phrase.big { display: block; font-size: 26px; text-align: center; margin: 16px 0 2px; padding: 18px 10px; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; }
.fp.small { font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; margin: 4px 0 14px; }
.device.pending .phrase { color: var(--warn); }
.badge-card h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0 0 8px; }
.waiting { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.waiting .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: desk-wait 1.6s ease-in-out infinite; }
@keyframes desk-wait { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.approve-how { margin: 10px 0; }
.warn-line { margin: 4px 0 0 26px; padding: 8px 10px; font-size: 13px; border-radius: var(--radius); background: color-mix(in srgb, var(--warn) 14%, var(--chrome)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }

/* ---------------------------------------------------------------- downloads */
.calm-line { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.print-wm { display: none; }
@media print {
  body.in-room .print-wm { display: block; position: fixed; left: 0; right: 0; bottom: 0; text-align: center; font: 8pt var(--sans); color: #7a1a1f; }
  .toast { display: none !important; }
}
