/* medical ai, in the omarchy style: pure black, monospace, hairlines, zero
   radius, one orange accent, hover inverts. Dark only. */

@font-face { font-family: JBM; font-weight: 100 500; font-display: swap; src: url("fonts/jbm-400.4d0ecc64.woff2") format("woff2"); }
@font-face { font-family: JBM; font-weight: 600 900; font-display: swap; src: url("fonts/jbm-700.691ea7e4.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #070708;
  --control: #0b0b0c;
  --raise: #0d0d0e;
  --line: #1d1d20;
  --line-strong: #26262a;
  --text: #e8e8e8;
  --heading: #f2f2f2;
  --muted: #76767d;
  --faint: #4a4a50;
  --invert: #e4e4e4;
  --accent: #ff5a36;
  --accent-hover: #ff7d5a;
  --on-accent: #000;
  --row: 1.8rem;
  --gap: 1rem;
  --side: 18rem;
  --mono: JBM, ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; box-shadow: none; }
html { background: var(--bg); scrollbar-color: var(--line-strong) transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--mono); -webkit-font-smoothing: antialiased; }
::selection { background: rgb(255 90 54 / .3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

h1 { font-size: 2.5rem; font-weight: 700; letter-spacing: -.05em; line-height: 1.1; color: var(--heading); margin: 0; text-transform: lowercase; }
.label, h2 { font-size: .75rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin: 0; }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--text); text-decoration: none; }
a:visited { color: var(--text); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .9rem; flex: none;
  font: 700 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  background: var(--control); color: var(--text); border: 1px solid var(--line-strong); cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.sm { height: 2rem; padding: 0 .7rem; font-size: .65rem; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.armed { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn:disabled { background: var(--control); color: var(--faint); border-color: var(--line); cursor: default; }

/* Hover only where there is a real pointer, so the inverted state never
   sticks after a tap on a touch screen. Touch gets the same block on :active. */
@media (hover: hover) {
  .btn:hover, button.chip:hover { background: var(--invert); color: #000; border-color: var(--invert); }
  .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn.armed:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
  .btn:disabled:hover { background: var(--control); color: var(--faint); border-color: var(--line); }
  .session:hover { background: var(--invert); color: #000; }
  .session:hover .session-date { color: #000; }
  a.file-open:hover, .files-toggle:hover, button.file-status:hover { background: var(--invert); color: #000; }
  .files-toggle:hover::after { color: #000; }
  .msg-md a:hover, .tool-link:hover, a.source-title:hover, .cite-link:hover, .activity-toggle:hover { background: var(--invert); color: #000; text-decoration: none; }
  .tool-link:hover .tool-domain { color: #000; }
  a.chart-save:hover { color: #000; }
}
@media (hover: none) {
  .btn:active:not(:disabled), button.chip:active, .session:active { background: var(--invert); color: #000; border-color: var(--invert); }
  .btn.primary:active:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
  .activity-toggle:active { background: var(--invert); color: #000; }
  a.file-open:active, .files-toggle:active, button.file-status:active { background: var(--invert); color: #000; }
}

/* inputs */
input, textarea { background: var(--control); color: var(--text); border: 1px solid var(--line-strong);
  font: 400 .85rem/1.5 var(--mono); outline: none; transition: border-color .15s; }
input { height: 2.25rem; padding: 0 .75rem; }
input::placeholder, textarea::placeholder { color: var(--faint); text-transform: uppercase; letter-spacing: .14em; }
input:focus, textarea:focus { border-color: var(--invert); }
input:focus-visible, textarea:focus-visible { outline: none; } /* the white border is the focus mark */
textarea:disabled { color: var(--faint); }

.error { margin: 0; color: var(--accent); font-size: .8rem; }
.error:empty { display: none; }

/* ---------- key screen ---------- */

.keyscreen { position: fixed; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; padding: 1rem; }
.keycard { width: min(26rem, 100%); background: var(--panel); border: 1px solid var(--line); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1rem; }
.keycard h1 { margin-bottom: .5rem; }
.keycard .btn { align-self: flex-start; }

/* ---------- app layout: fixed to the viewport edges (bottom: 0, not 100dvh) ---------- */

.app { position: fixed; top: 0; right: 0; bottom: var(--keyboard, 0px); left: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }

.side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.side-head { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; padding: 0 .75rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 700; font-size: 1.05rem; letter-spacing: -.04em; color: var(--heading); }
.side-label { padding: 1.25rem 1.25rem .6rem; }
.sessions { list-style: none; margin: 0; padding: 0 .75rem; overflow-y: auto; flex: 0 1 auto; min-height: 0; }
.session { display: flex; align-items: baseline; gap: .75rem; height: var(--row); padding: 0 .5rem; transition: background-color .15s, color .15s; }
.session-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; line-height: var(--row); }
.session-date { flex: none; font-size: .7rem; color: var(--muted); }
.session:focus-visible, .session[aria-current="page"] { background: var(--invert); color: #000; outline: none; }
.session:focus-visible .session-date, .session[aria-current="page"] .session-date { color: #000; }
.side-empty { margin: 0; padding: 0 1.25rem; color: var(--muted); font-size: .8rem; flex: none; }
.side-foot { padding: .75rem; border-top: 1px solid var(--line); }
.scrim { display: none; }

/* chats on top (at most 60% of the height while files are open), files
   under them; each list scrolls on its own. Short screens share one scroll. */
.side-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-chats { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; max-height: 60%; padding-bottom: .75rem; }
.side.files-collapsed .side-chats { flex: 1 1 auto; max-height: none; }
.side-files { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; border-top: 1px solid var(--line);
  outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; }
.side.files-collapsed .side-files { flex: none; }
.side-files.dragging { outline-color: var(--accent); }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex: none; padding: .6rem .75rem .4rem 1.25rem; }
.files-heading { margin: 0; font-size: inherit; letter-spacing: normal; }
.files-toggle { display: inline-flex; align-items: center; gap: .75rem; height: 2rem; margin-left: -.25rem; padding: 0 .25rem;
  font-family: var(--mono); background: none; border: 0; cursor: pointer; transition: background-color .15s, color .15s; }
.files-toggle::after { content: "hide"; color: var(--faint); font-weight: 700; }
.files-toggle[aria-expanded="false"]::after { content: "show"; }
.files-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.files-quota { margin: 0; padding: 0 1.25rem .5rem; font-size: .7rem; color: var(--muted); }
.files-quota:empty { display: none; }
.files-error { padding: 0 1.25rem .5rem; }
.files-notes { list-style: none; margin: 0; padding: 0 .75rem .5rem 1.25rem; display: flex; flex-direction: column; gap: .4rem; flex: none; }
.files-notes:empty { display: none; }
.files-note { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: .5rem; padding-left: .6rem; border-left: 2px solid var(--accent); }
.files-note.info { border-left-color: var(--line-strong); }
.files-note-name { min-width: 0; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-note-text { grid-column: 1 / -1; margin: 0; font-size: .75rem; line-height: 1.45; overflow-wrap: anywhere; }
.files-note.error .files-note-text { color: var(--accent); }
.files-list { list-style: none; margin: 0; padding: 0 .75rem; overflow-y: auto; flex: 0 1 auto; min-height: 0; }
.file-row { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-open { display: flex; align-items: center; min-width: 0; height: var(--row); padding: 0 .5rem; font-size: .85rem; transition: background-color .15s, color .15s; }
span.file-open { color: var(--muted); }
.file-open:focus-visible, .file-open[aria-current="page"] { background: var(--invert); color: #000; outline: none; }
.file-name { display: flex; flex: 1; min-width: 0; white-space: nowrap; }
.file-name-head { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-name-tail { flex: none; }
.file-meta { display: flex; align-items: center; gap: .75rem; min-height: 2rem; padding-left: .5rem; }
.file-size { flex: none; font-size: .7rem; color: var(--muted); }
.file-status-slot { display: flex; min-width: 0; }
.file-status { display: inline-flex; align-items: center; height: 1.5rem; padding: 0 .45rem; border: 1px solid var(--line-strong); background: none;
  font: 700 .6rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
button.file-status { cursor: pointer; transition: background-color .15s, color .15s; }
.file-status.failed { color: var(--accent); border-color: var(--accent); }
.file-delete { margin-left: auto; }
.file-error { margin: .2rem .5rem .1rem; font-size: .75rem; color: var(--accent); overflow-wrap: anywhere; }
.files-empty { padding: 0 1.25rem .75rem; font-size: .8rem; }
.files-empty p { margin: 0; }
.files-empty-title { color: var(--muted); }
.files-empty-text { color: var(--faint); font-size: .75rem; margin-top: .2rem !important; }
@media (max-height: 520px) {
  .side-scroll { overflow-y: auto; overscroll-behavior: contain; }
  .side-chats, .side-files, .files-body { flex: none; max-height: none; }
  .sessions, .files-list { overflow: visible; flex: none; }
}

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bar { display: flex; align-items: center; gap: .75rem; height: 3.5rem; flex: none; padding: 0 1.25rem; border-bottom: 1px solid var(--line); }
.drawer-toggle, .drawer-close { display: none; }
.side-actions { display: flex; gap: .25rem; }
.title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--heading); letter-spacing: -.02em; }

/* ---------- thread ---------- */

.thread { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 1.5rem 1.25rem; overscroll-behavior: contain; }
.thread > * { max-width: 48rem; margin-left: auto; margin-right: auto; }

.empty { padding-top: 18vh; }
.empty-title { margin: 0 0 .5rem; font-size: 2.5rem; font-weight: 700; letter-spacing: -.05em; line-height: 1.1; color: var(--heading); }
.empty-text { margin: 0; color: var(--muted); }

.msg { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: .6rem; }
.msg-role { font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.msg-date { font-size: .7rem; color: var(--faint); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-error { margin-top: .75rem; }

/* what the model searched and read, above its answer: a label, then the
   query or page in normal case. On small screens one summary line that
   expands. */
.activity { margin: 0 0 .6rem; min-width: 0; }
.activity-toggle { display: none; }
.msg-tools { list-style: none; margin: 0; padding: 0; }
.tool-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .75rem; min-width: 0; font-size: .8rem; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
.tool-verb { flex: none; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tool-detail { min-width: 0; color: var(--text); }
.tool-note { color: var(--faint); }
.tool-link { min-width: 0; color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: .2em; transition: background-color .15s, color .15s; }
.tool-link:visited { color: var(--text); }
.tool-domain { margin-left: .6rem; color: var(--muted); }

/* the sources the server listed, under the answer */
.sources-slot:empty { display: none; }
.sources { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.sources-label { margin-bottom: .4rem; }
.source-list { list-style: none; margin: 0; padding: 0; }
.source { display: flex; gap: .75rem; padding: .35rem 0 .35rem .5rem; margin-left: -.5rem; border-left: 2px solid transparent; min-width: 0; outline: none; }
.source.current { border-left-color: var(--accent); }
.source-n { flex: none; min-width: 1.5rem; font-size: .75rem; font-weight: 700; color: var(--muted); line-height: 1.6rem; }
.source-body { display: flex; flex-direction: column; min-width: 0; font-size: .85rem; line-height: 1.6; overflow-wrap: anywhere; }
.source-title { color: var(--text); }
a.source-title { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: .2em; transition: background-color .15s, color .15s; align-self: flex-start; max-width: 100%; }
a.source-title:visited { color: var(--text); }
.source-place { font-size: .75rem; color: var(--muted); }
.source-kind { font-size: .65rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.source-quote { margin: .2rem 0 0; font-size: .8rem; color: var(--muted); }

/* charts under an answer: the picture in a reserved 5:3 box (nothing
   moves when it loads), the caption, the data table and save link */
.charts-slot:empty { display: none; }
.chart { margin: 1rem 0 0; min-width: 0; }
.chart-box { display: grid; place-items: center; width: 100%; aspect-ratio: 5 / 3; border: 1px solid var(--line); background: var(--bg); }
.chart-box.chart-narrow { aspect-ratio: 6 / 5; }
.chart-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.chart-missing { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.chart-caption { margin: .4rem 0 0; font-size: .75rem; line-height: 1.5; color: var(--muted); }
.chart-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
a.chart-save, a.chart-save:visited { color: var(--text); }
.chart-data { margin-top: .6rem; min-width: 0; }
.chart-scroll { max-width: 100%; overflow-x: auto; }
.chart-table { border-collapse: collapse; font-size: .8rem; }
.chart-table-caption { caption-side: top; text-align: left; padding-bottom: .3rem; font-size: .75rem; color: var(--muted); }
.chart-table th, .chart-table td { border: 1px solid var(--line); padding: .2rem .6rem; text-align: left; white-space: nowrap; font-weight: 400; }
.chart-table thead th { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.chart-table tbody th { color: var(--muted); }
.chart-note { margin: .3rem 0 0; font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }

/* [n] in an answer: a small link to its source */
.cite { font-size: .7em; line-height: 0; vertical-align: super; }
.cite-link { position: relative; padding: 0 .1em; color: var(--muted); text-decoration: none; transition: background-color .15s, color .15s; }
.cite-link:visited { color: var(--muted); }

/* ---------- a personal file, read-only, page by page ---------- */

.viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.viewer-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); }
.viewer-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.viewer-page-label { color: var(--muted); }
.viewer-page { width: 4.5rem; height: 2rem; padding: 0 .5rem; text-align: right; appearance: textfield; -moz-appearance: textfield; }
.viewer-page::-webkit-inner-spin-button, .viewer-page::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.viewer-count { font-size: .75rem; color: var(--muted); min-width: 3rem; }
.viewer-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 1.25rem; }
.viewer-inner { max-width: 48rem; margin: 0 auto; }
.viewer-headings { display: flex; flex-wrap: wrap; gap: .2rem 1.25rem; margin: 0 0 .75rem; font-size: .75rem; color: var(--muted); overflow-wrap: anywhere; }
.viewer-inner .error { margin-bottom: .75rem; }
.viewer-text { margin: 0; font: inherit; font-size: .85rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.viewer-text[aria-busy="true"] { color: var(--faint); }
.quote-mark { background: var(--invert); color: #000; }

.thinking { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.thinking::after { content: "_"; margin-left: .3em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { color: transparent; } }

/* attachments in the thread */
.atts { list-style: none; margin: 0 0 .75rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.att { display: flex; flex-direction: column; gap: .35rem; min-width: 0; max-width: 100%; }
/* One fixed box for every thumbnail, local or stored, loading, loaded or
   failed: nothing moves when the image arrives or is re-encoded. */
.thumb { display: block; width: 12rem; height: 9rem; max-width: 100%; object-fit: contain; border: 1px solid var(--line); background: var(--panel); }
.chip { display: inline-block; max-width: 100%; height: 1.75rem; padding: 0 .6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 .75rem/1.65rem var(--mono); background: var(--control); color: var(--text); border: 1px solid var(--line-strong);
  cursor: pointer; text-align: left; transition: background-color .15s, color .15s, border-color .15s; }
.chip-static { cursor: default; }

/* rendered answers */
.msg-md { overflow-wrap: anywhere; }
.msg-md > :first-child { margin-top: 0; }
.msg-md > :last-child { margin-bottom: 0; }
.msg-md p, .msg-md ul, .msg-md ol, .msg-md pre, .msg-md blockquote, .msg-md table { margin: 0 0 .9rem; }
.msg-md h1, .msg-md h2, .msg-md h3, .msg-md h4, .msg-md h5, .msg-md h6 { margin: 1.4rem 0 .6rem; font-size: .75rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--accent); line-height: 1.5; }
.msg-md ul, .msg-md ol { padding-left: 1.5rem; }
.msg-md li + li { margin-top: .2rem; }
.msg-md strong { color: var(--heading); font-weight: 700; }
.msg-md a { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: .2em; }
.msg-md code { font: inherit; font-size: .9em; background: var(--control); border: 1px solid var(--line); padding: 0 .25rem; }
.msg-md pre { max-width: 100%; background: var(--panel); border: 1px solid var(--line); padding: .75rem 1rem; overflow-x: auto; overflow-wrap: normal; }
.msg-md pre code { background: none; border: 0; padding: 0; white-space: pre; }
.msg-md blockquote { border-left: 1px solid var(--line-strong); padding-left: 1rem; color: var(--muted); }
.msg-md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.msg-md table { max-width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: .85rem; }
.msg-md td, .msg-md th { overflow-wrap: normal; }
.msg-md th, .msg-md td { border: 1px solid var(--line); padding: .25rem .6rem; text-align: left; font-variant-numeric: tabular-nums; }
.msg-md th { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------- composer ---------- */

.composer { flex: none; display: flex; flex-direction: column; gap: .6rem; padding: .9rem 1.25rem 1rem; border-top: 1px solid var(--line); background: var(--bg);
  outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; }
.composer > * { width: 100%; max-width: 48rem; margin-left: auto; margin-right: auto; }
.composer.dragging { outline-color: var(--accent); }
.composer textarea { display: block; resize: none; padding: .55rem .75rem; min-height: 4.5rem; max-height: 40vh; field-sizing: content; }
.composer-row { display: flex; align-items: center; gap: .75rem; }
.hint { flex: 1; min-width: 0; font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.chips:empty { display: none; }
.chip-row { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.chip-row .chip { flex: 0 1 auto; min-width: 0; }
.chip-size { flex: none; font-size: .7rem; color: var(--muted); }

/* ---------- narrow screens: the chat list becomes a full-height drawer ---------- */

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; width: min(20rem, 85vw); visibility: hidden;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left); }
  body.drawer-open .side { visibility: visible; }
  body.drawer-open .scrim { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10; background: rgb(0 0 0 / .7); }
  .drawer-toggle, .drawer-close { display: inline-flex; }
  .drawer-toggle { margin-left: -.7rem; }
  .side-head { height: auto; min-height: 3.5rem; }
  .bar { height: auto; min-height: 3.5rem; padding: env(safe-area-inset-top) calc(1rem + env(safe-area-inset-right)) 0 calc(1rem + env(safe-area-inset-left)); }
  .thread { padding: 1rem calc(1rem + env(safe-area-inset-right)) 1rem calc(1rem + env(safe-area-inset-left)); }
  .composer { padding: .75rem calc(1rem + env(safe-area-inset-right)) calc(.75rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left)); }
  .hint { visibility: hidden; }
  .empty { padding-top: 8vh; }
  .empty-title { font-size: 2rem; }
  /* 44 px touch targets, 16 px inputs so iOS does not zoom on focus */
  .btn, .btn.sm { height: 2.75rem; min-width: 2.75rem; justify-content: center; }
  .session { height: 2.75rem; align-items: center; }
  .session-title { line-height: 2.75rem; }
  .chip { height: 2.75rem; line-height: 2.65rem; }
  input, textarea, .composer textarea { font-size: 16px; }
  input { height: 2.75rem; }
  .composer textarea { min-height: 3.25rem; max-height: 30vh; }
  .files-toggle { height: 2.75rem; }
  .file-open { height: 2.75rem; }
  .file-meta { min-height: 2.75rem; }
  .file-status { height: 1.75rem; }
  button.file-status { height: 2.75rem; }
  .viewer-bar { padding: .5rem calc(1rem + env(safe-area-inset-right)) .5rem calc(1rem + env(safe-area-inset-left)); }
  .viewer-page { height: 2.75rem; width: 4rem; }
  .viewer-scroll { padding: 1rem calc(1rem + env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left)); }
}

/* small screens: the activity list is one summary line that expands on tap;
   links and the toggle are 44 px touch targets */
@media (max-width: 600px) {
  .activity-toggle { display: flex; align-items: center; width: 100%; min-height: 2.75rem; padding: 0; background: none; border: 0; border-bottom: 1px solid var(--line);
    font: 700 .7rem/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: left; cursor: pointer; }
  .activity-toggle::after { content: "show"; margin-left: auto; padding-left: .75rem; color: var(--faint); }
  .activity.open .activity-toggle::after { content: "hide"; }
  .activity:not(.open) .msg-tools { display: none; }
  .msg-tools { padding-top: .35rem; }
  .tool-line { align-items: center; min-height: 2.75rem; }
  .tool-link { display: inline-flex; flex-wrap: wrap; align-items: center; column-gap: .6rem; min-height: 2.75rem; }
  .tool-domain { margin-left: 0; }
  a.source-title { display: inline-flex; align-items: center; min-height: 2.75rem; }
  .source-n { line-height: 2.75rem; }
  /* the page field says what it is through its label, read but not shown */
  .viewer-page-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* a wider tap area around the small [n] links, sideways only: it never
     reaches over the links of the lines above or below */
  .cite-link::after { content: ""; position: absolute; top: 0; right: -.5rem; bottom: 0; left: -.5rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
