/* dura's page. The look follows nanocode.xyz: one monospace face, a warm paper or
   near-black ground, hairline rules instead of boxes, widths counted in characters.
   Behaviour comes from UI SDK's elements; its stylesheet sits in the layer below. */
@layer ui-sdk;

@font-face {
  font-family: "Commit Mono";
  font-style: normal;
  font-weight: 200 700;
  font-display: swap;
  src: url("/fonts/CommitMono-VF.woff2") format("woff2");
}

:root {
  color-scheme: light dark;
  --bg: light-dark(#f1efe8, #0c0c0d);
  --surface: light-dark(#e7e4db, #151517);
  --text: light-dark(#141414, #e8e6e1);
  --middle: light-dark(#6f6c64, #8b8882);
  --rule: light-dark(#cdc9bd, #2b2a2e);
  --accent: light-dark(#ea4c0a, #ff5c1a);
  --on-accent: light-dark(#141414, #0c0c0d);
  --agent: light-dark(#0a7c8c, #3fd7e8);
  --bad: light-dark(#b3261e, #ff8a80);
  --mono: "Commit Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 4ch;

  /* the same colours and face for UI SDK's own styles */
  --ui-background: var(--bg);
  --ui-foreground: var(--text);
  --ui-muted: var(--surface);
  --ui-muted-foreground: var(--middle);
  --ui-border: var(--rule);
  --ui-input: var(--rule);
  --ui-primary: var(--accent);
  --ui-primary-foreground: var(--on-accent);
  --ui-destructive: var(--bad);
  --ui-ring: var(--accent);
  --ui-ring-border: var(--accent);
  --ui-radius: 0px;
  --ui-font-sans: var(--mono);
  --ui-font-mono: var(--mono);
  --ui-font-size: 0.8125rem;
  --ui-line-height: 1.0625rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-inline: var(--gutter);
  background: var(--bg);
  color: var(--text);
  font: 0.8125rem/1.0625rem var(--mono);
  font-variant-ligatures: none;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--middle);
}

a:hover {
  text-decoration-color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
p,
ul,
dl,
dd,
pre {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

h2 {
  font-size: inherit;
  font-weight: 400;
  color: var(--middle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hint {
  color: var(--middle);
}

.pad {
  padding: 1rem 2ch;
}

.error {
  color: var(--bad);
}

[hidden] {
  display: none !important;
}

/* ---- masthead: the name, and the fleet's numbers ---- */

.mast {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 4ch;
  padding-block: 2.5rem 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.mast h1,
.mast .tagline {
  font-size: 1.5rem;
  line-height: 2rem;
}

.mast h1 {
  font-weight: 700;
}

.mast .tagline {
  color: var(--middle);
}

.mast .who {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--middle);
  max-width: 44ch;
}

.mast .who.warn::before {
  content: "● ";
  color: var(--accent);
}

.fleet {
  display: flex;
  align-items: end;
  gap: 4ch;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 4ch;
}

.stats div {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt {
  color: var(--middle);
}

.stats dd {
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.stats dd[data-live="1"] {
  color: var(--accent);
}

/* ---- buttons, inputs ---- */

button {
  font: inherit;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
  height: auto;
  padding: 0.3125rem 1.5ch;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  border-color: var(--text);
}

button:disabled {
  color: var(--middle);
  cursor: default;
  border-color: var(--rule);
}

button.primary,
button.danger {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

button.primary:hover,
button.danger:hover {
  border-color: var(--text);
}

textarea {
  display: block;
  width: 100%;
  min-height: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.5rem 1ch;
  resize: vertical;
}

textarea::placeholder {
  color: var(--middle);
}

textarea:focus-visible {
  outline-offset: 0;
}

ui-textarea,
ui-button {
  display: contents;
}

/* ---- dialogs ---- */

[data-slot="alert-dialog-content"] {
  width: min(60ch, calc(100vw - 4ch));
  padding: 1.25rem 2ch;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: 0;
  box-shadow: none;
  display: grid;
  gap: 0.75rem;
}

[data-slot="alert-dialog-title"] {
  font-size: inherit;
  font-weight: 700;
}

[data-slot="alert-dialog-description"] {
  margin: 0;
  color: var(--middle);
}

.answers {
  display: flex;
  justify-content: flex-end;
  gap: 1ch;
  margin-top: 0.5rem;
}

/* what the owner sets: one dialog, a section for each thing */
dialog.settings {
  width: min(84ch, calc(100vw - 4ch));
  max-height: calc(100vh - 4rem);
  margin: auto;
  padding: 1.25rem 2ch 1.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--text);
  overflow: auto;
}

dialog.settings::backdrop {
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

dialog.settings > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2ch;
}

dialog.settings section {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

dialog.settings h3 {
  margin: 0;
  font-size: inherit;
  font-weight: 700;
}

dialog.settings code {
  font: inherit;
  color: var(--text);
}

dialog.settings .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2ch;
}

dialog.settings input[type="text"],
dialog.settings input[type="url"],
dialog.settings input[type="number"] {
  flex: 1 1 24ch;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.3125rem 1ch;
}

dialog.settings input[type="number"] {
  flex: 0 0 11ch;
  width: 11ch;
  text-align: right;
}

dialog.settings .field {
  display: inline-flex;
  align-items: center;
  gap: 1ch;
  white-space: nowrap;
}

dialog.settings input::placeholder {
  color: var(--middle);
}

dialog.settings .tick,
.setup .tick {
  display: inline-flex;
  align-items: center;
  gap: 1ch;
  white-space: nowrap;
  cursor: pointer;
}

dialog.settings .tick input {
  accent-color: var(--text);
}

.keys li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 2ch;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.keys li .name {
  flex: 1 1 16ch;
  min-width: 0;
  overflow-wrap: anywhere;
}

.keys li .about {
  color: var(--middle);
}

.shown-once {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 2ch;
  border: 1px solid var(--text);
}

.shown-once pre {
  margin: 0;
  font: inherit;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: all;
}

/* ---- the board: sessions | one session ---- */

.board {
  display: grid;
  grid-template-columns: 38ch minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
  min-height: 34rem;
}

.sessions {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rule);
  padding: 1rem 2ch 1rem 0;
  min-width: 0;
}

.sessions > .hint {
  padding-block: 0.5rem;
}

.list {
  margin-block: 0.5rem 1rem;
  max-height: 22rem;
  overflow-y: auto;
}

.list button {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr);
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 2px solid transparent;
  padding: 0.3125rem 1ch;
  white-space: normal;
}

.list button:hover {
  background: var(--surface);
}

.list button[aria-current="true"] {
  border-left-color: var(--accent);
  background: var(--surface);
}

.list .dot {
  color: var(--middle);
}

.list [data-state="running"] .dot,
.list [data-state="queued"] .dot {
  color: var(--accent);
}

.list [data-state="failed"] .dot {
  color: var(--bad);
}

.list .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list .sub {
  grid-column: 2;
  color: var(--middle);
}

.composer {
  margin-top: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.composer .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1ch;
  flex-wrap: wrap;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1ch;
}

.presets button {
  border-style: dashed;
  color: var(--middle);
  padding: 0.125rem 1ch;
}

.presets button:hover {
  color: var(--text);
}

[data-slot="segmented-control"] {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  isolation: isolate;
  border: 1px solid var(--rule);
}

[data-slot="segmented-control-item"] {
  padding: 0.3125rem 1.25ch;
  color: var(--middle);
  cursor: pointer;
}

[data-slot="segmented-control-item"][data-checked] {
  color: var(--text);
}

[data-slot="segmented-control-indicator"] {
  z-index: -1;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--accent);
  transition: left 120ms, width 120ms;
}

/* ---- one session ---- */

.session {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#one {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.125rem 2ch;
  padding: 1rem 0 0.75rem 2ch;
}

.head h2 {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.head .meta {
  grid-column: 1;
  color: var(--middle);
}

.head .meta [data-state="running"],
.head .meta [data-state="queued"] {
  color: var(--accent);
}

.head .meta [data-state="failed"] {
  color: var(--bad);
}

.head .actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: start;
  gap: 1ch;
}

/* the link to a session, shown to be copied by hand where the clipboard is not to be had */
.head .actions .link {
  font: inherit;
  font-size: 0.85em;
  width: 30ch;
  padding: 0.35rem 1ch;
  border: 1px solid var(--rule);
  background: transparent;
  color: inherit;
}

/* a session opened by its link: one session, to read. No list, nothing to send or delete. */
body[data-mode="shared"] .board {
  grid-template-columns: minmax(0, 1fr);
}

body[data-mode="shared"] .sessions,
body[data-mode="shared"] #follow,
body[data-mode="shared"] .head .actions {
  display: none;
}

[data-slot="tabs"] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

[data-slot="tabs-list"] {
  display: flex;
  gap: 3ch;
  padding-left: 2ch;
  border-bottom: 1px solid var(--rule);
  background: none;
  border-radius: 0;
}

[data-slot="tabs-list"] button {
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.375rem 0;
  color: var(--middle);
  background: none;
  box-shadow: none;
}

[data-slot="tabs-list"] button:hover {
  color: var(--text);
}

[data-slot="tabs-list"] button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.count {
  color: var(--middle);
}

[data-slot="tabs-panel"] {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.scroll {
  height: 30rem;
  border: 0;
  flex: 1;
}

.scroll [data-slot="scroll-area-content"] {
  padding: 0;
}

.transcript {
  padding: 0.75rem 2ch 1rem;
  display: grid;
  gap: 0.375rem;
  overflow-wrap: anywhere;
}

.t-prompt {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr);
  font-weight: 700;
  margin-top: 0.5rem;
  white-space: pre-wrap;
}

.t-prompt::before {
  content: ">";
  color: var(--accent);
}

.transcript > :first-child {
  margin-top: 0;
}

.t-text {
  white-space: pre-wrap;
  padding-left: 2ch;
}

.t-text[data-cut] {
  color: var(--middle);
}

/* an answer that is whole, read as what it was written as: paragraphs, lists, code */
.t-body.prose {
  white-space: normal;
  display: grid;
  gap: 0.5rem;
}

.prose p,
.prose ul,
.prose ol,
.prose pre {
  margin: 0;
}

/* a paragraph keeps the lines it was written in */
.prose p,
.prose li {
  white-space: pre-line;
}

.prose .h {
  font-weight: 700;
}

/* what was asked for and is not there: not to be read past */
.prose .missing {
  color: var(--accent);
}

.prose ul,
.prose ol {
  padding-left: 3ch;
}

.prose ul {
  list-style-type: "- ";
}

.prose ol {
  list-style-type: decimal;
}

.prose code,
.prose pre {
  font: inherit;
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.prose code {
  padding: 0 0.5ch;
}

.prose pre {
  padding: 0.5rem 1ch;
  overflow-x: auto;
  white-space: pre;
}

.prose .file {
  font: inherit;
  color: inherit;
  white-space: normal;
}

/* what should not be missed, and is no error */
.warn,
.plain.warn {
  color: var(--accent);
}

.t-reason {
  white-space: pre-wrap;
  padding-left: 2ch;
  color: var(--middle);
  font-style: italic;
}

.t-note {
  padding-left: 2ch;
  color: var(--middle);
}

.t-note[data-tone="bad"] {
  color: var(--bad);
}

.t-note[data-tone="good"] {
  color: var(--text);
}

.t-mark {
  display: flex;
  align-items: center;
  gap: 1ch;
  color: var(--accent);
  font-weight: 700;
  margin-block: 0.25rem;
}

.t-mark::before,
.t-mark::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--accent);
}

.t-mark::before {
  flex: 0 0 2ch;
}

.who {
  color: var(--agent);
}

details.t-tool {
  padding-left: 2ch;
}

details.t-tool[data-nested] {
  padding-left: 4ch;
}

details.t-tool summary {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr) auto;
  gap: 0 0;
  cursor: pointer;
  list-style: none;
  color: var(--agent);
}

details.t-tool summary::-webkit-details-marker {
  display: none;
}

details.t-tool summary::before {
  content: "·";
}

details.t-tool[open] summary::before {
  content: "▾";
}

details.t-tool .cmd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

details.t-tool .cmd b {
  color: var(--agent);
  font-weight: 400;
}

details.t-tool .status {
  color: var(--middle);
  padding-left: 2ch;
}

details.t-tool[data-status="failed"] .status,
details.t-tool[data-status="unknown"] .status {
  color: var(--bad);
}

details.t-tool[data-status="running"] .status {
  color: var(--accent);
}

details.t-tool pre {
  margin: 0.25rem 0 0.5rem 2ch;
  padding: 0.5rem 1ch;
  background: var(--surface);
  white-space: pre-wrap;
  max-height: 22rem;
  overflow: auto;
  font: inherit;
}

details.t-tool pre + pre {
  margin-top: -0.25rem;
}

.follow {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr) auto;
  align-items: start;
  gap: 0 1ch;
  padding: 0.5rem 0 0.75rem 2ch;
  border-top: 1px solid var(--rule);
}

/* ---- calls that wait for the owner ---- */

.holds {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 0 0.5rem 2ch;
  border-top: 1px solid var(--rule);
}

.hold {
  display: grid;
  gap: 0.375rem;
  padding: 0.5rem 1ch;
  border-left: 2px solid var(--accent);
  background: var(--surface);
}

.hold[data-phase="uncertain"] {
  border-left-color: var(--bad);
}

.hold p {
  margin: 0;
}

.hold .input {
  width: 100%;
  font: inherit;
  font-size: 0.875em;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.25rem 0.5ch;
  resize: vertical;
}

.hold .input:read-only {
  color: var(--middle);
}

.hold .words {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.25rem 0.5ch;
}

.hold .does {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2ch;
}

.hold .error {
  color: var(--bad);
}

#sessions .asks {
  color: var(--accent);
}

.accounts label.ask {
  color: var(--middle);
  white-space: nowrap;
}

.follow label {
  color: var(--accent);
  padding-top: 0.5625rem;
}

/* ---- trees: agents, files ---- */

[data-slot="tree"] {
  max-width: none;
  gap: 0;
  padding: 0.5rem 0 0.5rem 1ch;
}

[data-slot="tree-group"] {
  gap: 0;
  margin: 0;
}

[data-slot="tree-label"] {
  display: flex;
  align-items: baseline;
  gap: 1ch;
  padding: 0.1875rem 1ch;
  /* the item sets --tree-level, from 1 */
  padding-left: calc((var(--tree-level, 1) - 1) * 2ch + 1ch);
  cursor: pointer;
  border-radius: 0;
  min-height: 0;
}

[data-slot="tree-label"]:hover {
  background: var(--surface);
}

[data-slot="tree-item"][aria-selected="true"] > [data-slot="tree-label"] {
  background: var(--surface);
  box-shadow: inset 2px 0 0 var(--accent);
}

[data-slot="tree-item"]:focus-visible {
  outline: none;
}

[data-slot="tree-item"]:focus-visible > [data-slot="tree-label"] {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

[data-slot="tree-indicator"] {
  display: inline-block;
  width: 1ch;
  color: var(--middle);
  transition: rotate 100ms;
}

[data-slot="tree-indicator"]::before,
[data-slot="tree-indicator"]::after {
  content: none;
}

[data-slot="tree-indicator"][data-expanded] {
  rotate: 90deg;
}

.a-role {
  font-weight: 700;
}

.a-state {
  color: var(--middle);
}

.a-state[data-state="running"],
.a-state[data-state="pending"] {
  color: var(--accent);
}

.a-state[data-state="failed"],
.a-state[data-state="interrupted"] {
  color: var(--bad);
}

.a-task {
  color: var(--middle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.files {
  display: grid;
  grid-template-columns: 40ch minmax(0, 1fr);
  min-height: 30rem;
  flex: 1;
}

.files .tree {
  border-right: 1px solid var(--rule);
  overflow: auto;
  max-height: 34rem;
}

.files .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1ch;
  padding: 0.5rem 2ch;
  border-bottom: 1px solid var(--rule);
  min-height: 2.75rem;
}

.files .viewer {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.files pre {
  margin: 0;
  padding: 0.75rem 2ch;
  overflow: auto;
  max-height: 31rem;
  font: inherit;
  white-space: pre;
  tab-size: 4;
}

/* ---- what a session's agents changed ---- */

.diff {
  margin: 0;
  padding: 0.75rem 2ch;
  overflow: auto;
  max-height: 34rem;
  font: inherit;
  white-space: pre;
  tab-size: 4;
}

.diff .file {
  color: var(--text);
  font-weight: 600;
}

.diff .hunk,
.diff .about {
  color: var(--middle);
}

.diff .add {
  color: var(--agent);
}

.diff .del {
  color: var(--bad);
}

/* ---- what a session made ---- */

.made {
  display: grid;
  grid-template-columns: 46ch minmax(0, 1fr);
  min-height: 30rem;
  flex: 1;
}

.made .kept {
  border-right: 1px solid var(--rule);
  overflow: auto;
  max-height: 40rem;
}

.made .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1ch;
  padding: 0.5rem 2ch;
  border-bottom: 1px solid var(--rule);
  min-height: 2.75rem;
}

.made ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.made li {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  gap: 0 1ch;
  padding: 0.6rem 2ch;
  border-bottom: 1px solid var(--rule);
}

.made li .n {
  color: var(--middle);
}

.made li[data-live] .n {
  color: var(--accent);
  font-weight: 700;
}

.made li .about {
  color: var(--middle);
}

.made li .what,
.made li .does {
  grid-column: 2;
}

.made li .what {
  overflow-wrap: anywhere;
}

.made .does {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2ch;
}

.made li .does {
  margin-top: 0.35rem;
}

/* who pays for the model: one line for each kind of account */
.accounts {
  display: grid;
  gap: 0.4rem;
}

.accounts .item,
.accounts form {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 2ch;
}

.accounts .name {
  flex: 0 0 16ch;
  font-weight: 700;
}

.accounts .plan {
  display: grid;
  gap: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.accounts .plan .hint {
  margin: 0;
}

.accounts input[type="text"] {
  flex: 1 1 24ch;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.3125rem 1ch;
}

.accounts .about {
  flex: 1 1 16ch;
  color: var(--middle);
}

.accounts .does {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 2ch;
}

.accounts .item[data-off="true"] .name {
  color: var(--middle);
}

.accounts details.about summary {
  cursor: pointer;
}

.accounts .tools {
  margin: 0.3rem 0 0;
  padding-left: 2ch;
  color: var(--middle);
}

.accounts .tools code {
  color: var(--text);
}

.accounts input[type="password"] {
  flex: 1 1 24ch;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.3125rem 1ch;
}

#payer {
  margin: 0.35rem 0 0;
}

.plan-note {
  margin: 0.5rem 0 0;
  padding: 0.5rem 1ch;
  border: 1px solid var(--rule);
}

/* what its app is set up with: under the line about the link, above what the link shows */
.setup {
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem 2ch;
  border-bottom: 1px solid var(--rule);
}

.setup h4 {
  margin: 0.25rem 0 0;
  font: inherit;
  color: var(--middle);
}

.setup .item,
.setup form {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 2ch;
}

.setup .item .name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.setup .item .about {
  flex: 1 1 20ch;
  min-width: 0;
  color: var(--middle);
}

.setup .item .value {
  overflow-wrap: anywhere;
  user-select: all;
}

.setup input[type="text"],
.setup input[type="password"] {
  flex: 1 1 22ch;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.3125rem 1ch;
}

.setup input.name {
  flex: 0 1 24ch;
}

.setup .said:empty {
  display: none;
}

/* something to do, said as a word in the line it belongs to */
.plain,
.t-note .see,
.t-prompt .see {
  border: 0;
  background: none;
  padding: 0;
  white-space: nowrap;
  color: var(--middle);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.plain:hover,
.t-prompt .see.icon,
.t-note .see.icon {
  display: inline-flex;
  vertical-align: -0.15em;
  margin-left: 0.5ch;
  cursor: pointer;
}

.t-note .see:hover,
.t-prompt .see:hover {
  color: var(--text);
}

.made .shown {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.made .frame {
  flex: 1;
  display: flex;
  min-height: 30rem;
  /* what a page is drawn on when it says nothing itself */
  background: #fff;
}

.made .frame[hidden] {
  display: none;
}

.made iframe {
  flex: 1;
  width: 100%;
  border: 0;
}

.made pre {
  margin: 0;
  padding: 0.75rem 2ch;
  overflow: auto;
  max-height: 12rem;
  font: inherit;
  white-space: pre-wrap;
  color: var(--middle);
  border-bottom: 1px solid var(--rule);
}

/* ---- VM timeline ---- */

.timeline {
  padding-block: 1rem 3rem;
  overflow-x: clip;
}

.timeline h2 .hint {
  text-transform: none;
  letter-spacing: 0;
}

.timeline > .hint {
  padding-top: 0.5rem;
}

[data-slot="waterfall"] {
  display: grid;
  grid-template-columns: minmax(18ch, 46ch) 10ch minmax(0, 1fr);
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}

[data-slot="waterfall-header-row"],
[data-slot="waterfall-row"] {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  align-items: center;
  min-height: 1.375rem;
  border-bottom: 1px solid var(--rule);
}

[data-slot="waterfall-header-row"] {
  color: var(--middle);
}

[data-slot="waterfall-column-header"] {
  position: relative;
  font-weight: 400;
  text-align: left;
  min-height: 1.375rem;
  padding-block: 0.1875rem;
}

[data-slot="waterfall-row"]:hover,
[data-slot="waterfall-row"][data-selected] {
  background: var(--surface);
}

[data-slot="waterfall-row-header"] {
  display: flex;
  gap: 1ch;
  min-width: 0;
  padding-left: calc((var(--waterfall-level, 1) - 1) * 2ch);
  white-space: nowrap;
  font-weight: 400;
  text-align: left;
}

[data-slot="waterfall-row-header"] > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-slot="waterfall-row"][data-level="2"] [data-slot="waterfall-row-header"] {
  color: var(--middle);
}

[data-slot="waterfall-indicator"] {
  display: inline-block;
  width: 1ch;
  cursor: pointer;
  color: var(--middle);
  transition: rotate 100ms;
}

[data-slot="waterfall-indicator"][data-expanded] {
  rotate: 90deg;
}

[data-slot="waterfall-cell"] {
  text-align: right;
  padding-right: 2ch;
  color: var(--middle);
}

[data-slot="waterfall-bar"] {
  position: relative;
  height: 1.375rem;
}

[data-slot="waterfall-bar"]::before {
  content: "";
  position: absolute;
  inset-block: 0.3125rem;
  inset-inline-start: var(--waterfall-start);
  width: max(var(--waterfall-size), 2px);
  background: var(--text);
}

[data-slot="waterfall-row"][data-kind="restore"] [data-slot="waterfall-bar"]::before {
  background: var(--middle);
}

[data-slot="waterfall-row"][data-kind="call"] [data-slot="waterfall-bar"]::before {
  background: var(--agent);
}

[data-slot="waterfall-row"][data-kind="gone"] [data-slot="waterfall-bar"]::before {
  background: var(--rule);
}

[data-slot="waterfall-row"][data-kind="vm"][data-live] [data-slot="waterfall-bar"]::before {
  background: var(--accent);
}

[data-slot="waterfall-row"][data-killed] [data-slot="waterfall-bar"]::before {
  background: repeating-linear-gradient(135deg, var(--accent) 0 3px, transparent 3px 6px);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

[data-slot="waterfall-axis"] {
  position: absolute;
  inset: 0;
}

[data-slot="waterfall-tick"] {
  position: absolute;
  inset-inline-start: var(--waterfall-tick);
  padding: 0.1875rem 0 0 0.5ch;
  border-left: 1px solid var(--rule);
  height: 100%;
  white-space: nowrap;
}

[data-slot="waterfall-mark"] {
  position: absolute;
  inset-inline-start: var(--waterfall-mark);
  top: 0;
  height: 1.375rem;
  padding-left: 0.5ch;
  border-left: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
  z-index: 1;
}

[data-slot="waterfall-mark"][data-outside] {
  display: none;
}

/* near the right edge the label goes to the left of its line */
[data-slot="waterfall-mark"][data-flip] {
  translate: -100%;
  padding: 0 0.5ch 0 0;
  border-left: 0;
  border-right: 2px solid var(--accent);
}

/* ---- the daemon is down ---- */

.down {
  position: sticky;
  top: 0;
  z-index: 40;
  margin-inline: calc(var(--gutter) * -1);
  padding: 0.5rem var(--gutter);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.down[data-back] {
  background: var(--text);
  color: var(--bg);
}

@media (max-width: 60rem) {
  :root {
    --gutter: 2ch;
  }

  .board {
    grid-template-columns: minmax(0, 1fr);
  }

  .sessions {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
  }

  .head,
  [data-slot="tabs-list"],
  .follow {
    padding-left: 0;
  }

  .transcript {
    padding-inline: 0;
  }

  .files {
    grid-template-columns: minmax(0, 1fr);
  }

  .files .tree {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .made {
    grid-template-columns: minmax(0, 1fr);
  }

  .made .kept {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  [data-slot="waterfall"] {
    grid-template-columns: minmax(12ch, 22ch) 8ch minmax(0, 1fr);
  }

  /* no room for a mark's words beside the other columns: its line stays */
  [data-slot="waterfall-mark"] {
    font-size: 0;
    padding: 0;
    translate: none;
  }
}

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