:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1b1c1f;
  --muted: #6b6e76;
  --line: #e2e2de;
  --accent: #2f6fdf;
  --accent-text: #ffffff;
  --waiting: #b8620a;
  --waiting-bg: #fdf0e1;
  --running: #2f6fdf;
  --running-bg: #e6eefc;
  --done: #2e8a4e;
  --done-bg: #e3f3e8;
  --failed: #c23a3a;
  --failed-bg: #fbe7e7;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --surface: #1f2024;
    --text: #ececea;
    --muted: #9a9ca3;
    --line: #2e3036;
    --accent: #5b8ff0;
    --accent-text: #0e0f11;
    --waiting: #f0a050;
    --waiting-bg: #3a2a18;
    --running: #7aa6f5;
    --running-bg: #1d2a42;
    --done: #6cc98c;
    --done-bg: #183224;
    --failed: #ef7b7b;
    --failed-bg: #3d1e1e;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(32px + env(safe-area-inset-bottom));
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 calc(-1 * var(--gutter));
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar h1 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar a,
.bar .mark {
  color: var(--text);
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  min-width: 32px;
  text-align: center;
}

h2 {
  margin: 20px 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 14px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.tabs .tab {
  flex: 1;
  min-height: 36px;
  margin: 0;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  background: transparent;
  color: var(--muted);
}

.tabs .tab.on {
  background: var(--line);
  color: var(--text);
}

.needs {
  margin-top: 18px;
}

.needs-head {
  margin: 0;
  color: var(--waiting);
}

.group {
  margin-top: 18px;
}

.group-head {
  position: sticky;
  /* Under the page's own bar, whose height app.js measures. */
  top: var(--bar-height, 0px);
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  background: var(--bg);
  font-size: 13px;
}

.group-label {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--line);
  color: var(--text);
  font: 600 12px/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
}

.project-head .caret {
  width: 14px;
  font-size: 14px;
  color: var(--muted);
}

.project-head .project-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-head .tally {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.word.failed {
  color: var(--failed);
}

.word.waiting {
  color: var(--waiting);
}

.word.running {
  color: var(--running);
}

.word.done {
  color: var(--done);
}

.more {
  align-self: flex-start;
  min-height: 32px;
  margin: 0;
  padding: 0 4px 0 28px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

.row.rest {
  border-style: dashed;
  background: transparent;
}

.limits-line {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}

p.limits-line {
  background: transparent;
  border-style: dashed;
}

.limits-line .line {
  align-items: baseline;
}

.pct,
.limit-pct {
  font-weight: 600;
}

.pct.waiting,
.limit-pct.waiting {
  color: var(--waiting);
}

.pct.failed,
.limit-pct.failed {
  color: var(--failed);
}

.meter {
  display: block;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  background: var(--muted);
}

.meter-fill.waiting {
  background: var(--waiting);
}

.meter-fill.failed {
  background: var(--failed);
}

.panel.limits {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel.limits h2 {
  margin: 0;
}

.limit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.limit-name {
  font-weight: 600;
}

.limit-pct {
  font-size: 20px;
}

.limit .meter {
  height: 6px;
}

.origin {
  margin: 0;
  font: 13px var(--mono);
  color: var(--muted);
}

.next-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 16px calc(-1 * var(--gutter)) 0;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.next-bar a {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.next-list {
  flex: none;
  align-items: center;
  padding: 0 14px;
  min-height: 48px;
  font-weight: 600;
}

.next-go {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 4px 14px;
  border-color: var(--waiting) !important;
}

.next-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--waiting);
  text-transform: uppercase;
}

.next-title {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-none {
  align-self: center;
  font-size: 14px;
}

.prompt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.prompt-screen {
  margin: 0;
  padding: 10px;
  overflow-x: auto;
  font: 12px/1.4 var(--mono);
  white-space: pre;
  background: var(--bg);
  border-radius: 8px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  justify-content: flex-start;
  text-align: left;
  font-weight: 400;
}

.choice.chosen {
  border-color: var(--waiting);
}

.choice-key {
  flex: none;
  font: 600 14px var(--mono);
  color: var(--waiting);
}

.choice-label {
  overflow-wrap: anywhere;
}

.opened {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.opened-caption {
  margin: 4px 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.versions {
  margin-top: 24px;
  font-size: 13px;
}

.list.project {
  margin-top: 12px;
}

.list.project h3 {
  margin: 0;
}

.panel,
.compose,
.answer,
.screen-box,
.card-head,
.paste {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.row.waiting {
  border-color: var(--waiting);
}

.row.inert {
  opacity: 0.6;
}

/* Not opened from the phone, but at work: not dimmed like a session at rest. */
.row.inert.command {
  opacity: 1;
}

.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.question {
  display: block;
  margin: 8px 0 0;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sub.question {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chip {
  flex: none;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--line);
  color: var(--muted);
}

.chip.waiting {
  background: var(--waiting-bg);
  color: var(--waiting);
}

.chip.running {
  background: var(--running-bg);
  color: var(--running);
}

.chip.done {
  background: var(--done-bg);
  color: var(--done);
}

.chip.failed {
  background: var(--failed-bg);
  color: var(--failed);
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 14px;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  margin-top: 12px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

button.danger {
  color: var(--failed);
}

button.quiet {
  border-color: transparent;
  background: none;
  color: var(--muted);
}

button.small {
  min-height: 36px;
  margin-top: 0;
  padding: 0 12px;
  font-size: 14px;
}

.panel button {
  width: 100%;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  flex: 1;
}

.keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.keys button.key {
  margin: 0;
  padding: 0;
  min-height: 40px;
  font-family: var(--mono);
  font-size: 14px;
}

.code {
  margin: 16px 0;
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
}

.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.screen {
  max-height: 60vh;
  margin: 12px 0 0;
  padding: 10px;
  overflow: auto;
  font: 12px/1.35 var(--mono);
  background: var(--bg);
  border-radius: 8px;
  white-space: pre;
}

.status {
  margin-top: 16px;
}

.status.down {
  padding: 12px 14px;
  background: var(--failed-bg);
  border-radius: var(--radius);
}

.status.down p {
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

.center {
  text-align: center;
}

.error {
  color: var(--failed);
  overflow-wrap: anywhere;
}

.error:empty,
.result:empty {
  display: none;
}

.result {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.notice {
  margin: 16px 0 0;
  padding: 10px 14px;
  background: var(--done-bg);
  color: var(--done);
  border-radius: var(--radius);
}

.notice.update {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--running-bg);
  color: var(--running);
}

.notice.update button {
  flex: none;
  width: auto;
  margin: 0;
}

.md {
  overflow-wrap: anywhere;
}

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

.md p,
.md ul,
.md ol,
.md blockquote,
.md pre,
.md .md-table {
  margin: 0 0 10px;
}

.md ul,
.md ol {
  padding-left: 22px;
}

.md li > p,
.md li > ul,
.md li > ol {
  margin: 0;
}

.md .md-h {
  margin: 14px 0 6px;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.md code {
  font: 13px var(--mono);
  padding: 1px 4px;
  background: var(--bg);
  border-radius: 4px;
}

.md pre {
  padding: 10px;
  overflow-x: auto;
  background: var(--bg);
  border-radius: 8px;
}

.md pre code {
  padding: 0;
  white-space: pre;
}

.md blockquote {
  padding-left: 10px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.md hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.md .md-table {
  overflow-x: auto;
}

.md table {
  border-collapse: collapse;
  font-size: 14px;
}

.md th,
.md td {
  padding: 4px 8px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.md .md-link {
  color: var(--accent);
  text-decoration: underline;
}

.paste summary {
  cursor: pointer;
  color: var(--muted);
}

.paste input {
  margin-top: 12px;
}

ol {
  padding-left: 20px;
}

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

.warn {
  padding: 10px 12px;
  background: var(--waiting-bg);
  color: var(--waiting);
  border-radius: 10px;
  font-size: 14px;
}

.qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 12px auto;
  /* The code is black on white whatever the theme, so a camera reads it. */
  background: #ffffff;
  border-radius: 8px;
}

.camera {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #000000;
  border-radius: 10px;
}

main > button {
  width: 100%;
  margin-top: 16px;
}

/* Starting a session from the phone. */

.bar .plus {
  font-size: 28px;
  font-weight: 300;
}

.field {
  display: block;
  margin-top: 14px;
}

.field:first-child {
  margin-top: 0;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.start .note {
  margin: 12px 0 0;
  font-size: 13px;
}

.row.command .sub {
  font-variant-numeric: tabular-nums;
}
