/* The one stylesheet every page loads: light and dark themes through prefers-color-scheme, system fonts, and a layout that holds at phone width with a sixteen-pixel gutter and no horizontal page scroll. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-strong: #eaeef2;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --border-strong: #b7c0c9;
  --accent: #0969da;
  --accent-bg: #0969da;
  --accent-text: #ffffff;
  --danger: #cf222e;
  --ok: #1a7f37;
  --warn: #9a6700;
  --warn-bg: #fff8c5;
  --warn-border: #d4a72c;
  --error-bg: #ffebe9;
  --error-border: #ff8182;
  --chip-bg: #ddf4ff;
  --chip-text: #0550ae;
  --chip-border: #54aeff;
  --assistant-bg: #f6f8fa;
  --shadow: 0 8px 24px rgb(31 35 40 / 15%);
  --radius: 6px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #151b23;
    --surface-strong: #212830;
    --text: #e6edf3;
    --muted: #9198a1;
    --border: #3d444d;
    --border-strong: #59636e;
    --accent: #4493f8;
    --accent-bg: #1f6feb;
    --accent-text: #ffffff;
    --danger: #f85149;
    --ok: #3fb950;
    --warn: #d29922;
    --warn-bg: #272115;
    --warn-border: #9e6a03;
    --error-bg: #25171c;
    --error-border: #8e1519;
    --chip-bg: #121d2f;
    --chip-text: #79c0ff;
    --chip-border: #1f6feb;
    --assistant-bg: #151b23;
    --shadow: 0 8px 24px rgb(1 4 9 / 60%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-width: 0;
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

img {
  max-width: 100%;
}

pre {
  margin: 0;
  font: 12.5px/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.offscreen {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

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

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

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.spacer {
  flex: 1 1 auto;
}

/* Controls */

button,
.button,
summary.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

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

button.primary:hover:not(:disabled) {
  background: var(--accent-bg);
  filter: brightness(1.08);
}

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

button.small,
.button.small {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 13px;
}

button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
}

button.link:hover:not(:disabled) {
  background: none;
}

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

button.tool:hover:not(:disabled) {
  color: var(--text);
}

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

button.tool-set {
  color: var(--accent);
}

.file-button {
  position: relative;
}

.file-button:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

input,
textarea,
select {
  max-width: 100%;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface);
  color: var(--muted);
}

textarea {
  display: block;
  width: 100%;
  line-height: 1.5;
}

textarea.autosize {
  field-sizing: content;
  resize: none;
  overflow-y: hidden;
  min-height: calc(1.5em + 12px);
}

textarea[aria-invalid="true"],
input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.field > input,
.field > select,
.field > textarea {
  width: 100%;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

.field-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-error {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.custom-note {
  font-size: 12px;
  color: var(--warn);
}

.read-only .custom-note button {
  display: none;
}

.json-editor {
  font: 12.5px/1.45 var(--mono);
}

/* Page frame */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px var(--gutter);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 16px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 13px;
}

.back {
  white-space: nowrap;
}

.back::before {
  content: "\2190\00a0";
}

.title-input {
  flex: 1 1 240px;
  min-width: 0;
  border-color: transparent;
  background: transparent;
  font-size: 17px;
  font-weight: 600;
}

.title-input:hover,
.title-input:focus {
  border-color: var(--border);
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px var(--gutter) 32px;
}

.page-wide {
  max-width: 1200px;
}

.page-narrow {
  max-width: 480px;
  padding-top: 48px;
}

.page-title {
  margin: 0 0 16px;
}

.section-title {
  margin: 16px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.filter {
  flex: 1 1 200px;
}

.notices:empty {
  display: none;
}

.notice,
.field-notice {
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice-warn,
.field-notice[data-kind="conflict"] {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.notice-error,
.field-notice[data-kind="error"] {
  border-color: var(--error-border);
  background: var(--error-bg);
}

.field-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.notice-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.save-state,
.stream-state {
  color: var(--muted);
  white-space: nowrap;
}

.save-state[data-state="conflict"],
.save-state[data-state="error"],
.stream-state[data-state="refused"] {
  color: var(--danger);
  white-space: normal;
}

.save-state[data-state="pending"],
.save-state[data-state="saving"],
.stream-state[data-state="reconnecting"],
.stream-state[data-state="waiting"] {
  color: var(--warn);
}

.badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 12px;
}

/* Conversation list */

.conversation-list,
.component-list,
.device-list,
.picker-list,
.usage-list,
.revisions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.conv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.conv-link {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  padding: 10px 4px;
  color: inherit;
  text-decoration: none;
}

.conv-link:hover .conv-title {
  text-decoration: underline;
}

.conv-first {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

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

.conv-title.conv-preview {
  font-weight: 400;
  color: var(--muted);
}

.conv-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--muted);
}

.conv-model {
  overflow-wrap: anywhere;
}

.running-badge {
  flex: none;
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
}

.running-badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.trash-section {
  margin-top: 24px;
}

.trash {
  margin-top: 8px;
}

.trash-row .row {
  flex: none;
}

/* Conversation editor */

.settings-bar {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: end;
  gap: 8px;
}

.settings-tail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.settings-summary {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.settings-more {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.field-group {
  display: contents;
}

.json-editors {
  margin-top: 8px;
}

.json-editors summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
}

.json-editors .field {
  margin-top: 6px;
}

.system-section {
  margin-top: 8px;
}

.messages {
  margin-top: 8px;
}

.message {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.message[data-role="assistant"] {
  background: var(--assistant-bg);
}

.message[data-state="live"] {
  border-color: var(--accent);
}

.message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.message-head select.role {
  min-height: 26px;
  padding: 1px 6px;
  font-size: 13px;
  font-weight: 600;
}

.message[data-role="system"] {
  border-style: dashed;
  background: var(--surface);
}

.message-extra-slot:empty {
  display: none;
}

.message-extra-slot .extra-panel {
  padding: 8px 8px 0;
}

.message-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
}

.message-save[data-state="conflict"],
.message-save[data-state="error"] {
  color: var(--danger);
}

.message-save[data-state="pending"],
.message-save[data-state="saving"] {
  color: var(--warn);
}

.message-notice .field-notice {
  margin: 8px;
}

.message-body {
  padding: 8px;
}

.run-line {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.run-state {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.run-state[data-status="failed"],
.run-state[data-status="interrupted"] {
  color: var(--danger);
}

.run-state[data-status="cancelled"] {
  color: var(--muted);
}

.run-state[data-status="pending"],
.run-state[data-status="streaming"] {
  color: var(--accent);
}

.run-state[data-status="retrying"] {
  color: var(--warn);
}

.add-messages {
  margin: 12px 0 24px;
}

/* Blocks */

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

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

.block {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.segments {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

textarea.segment {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 6px 8px;
}

textarea.segment:focus {
  outline: none;
  background: var(--surface);
}

textarea.segment:focus-visible {
  outline: none;
}

.chip {
  align-self: flex-start;
  max-width: calc(100% - 16px);
  min-height: 24px;
  margin: 2px 8px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--chip-border);
  border-radius: 12px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 13px;
  text-overflow: ellipsis;
}

.chip::before {
  content: "\25c6\00a0";
  font-size: 10px;
}

.chip-missing {
  border-style: dashed;
  color: var(--danger);
}

.insert-point {
  display: block;
  width: 100%;
  min-height: 0;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  font-size: 12px;
  line-height: 18px;
}

.insert-point:hover:not(:disabled),
.insert-point:focus-visible {
  background: var(--surface);
  color: var(--accent);
}

.insert-point:disabled {
  visibility: hidden;
}

.block-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
  padding: 0 4px 2px;
}

.blocks > .block:only-child [data-test="block-move-up"],
.blocks > .block:only-child [data-test="block-move-down"] {
  display: none;
}

.block.virtual .block-tools,
.read-only .block-tools,
.read-only .insert-point,
.read-only [data-test="raw-edit-json"] {
  display: none;
}

.extra-panel {
  padding: 4px 8px 8px;
}

.raw-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 4px 8px;
  font-size: 13px;
  color: var(--muted);
}

.raw-type,
.device-name,
.revision-head,
.usage-list a,
.picker-item strong,
.notice,
.field-notice,
.notice-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.raw-head .block-tools {
  margin-left: auto;
  padding: 0;
}

.raw-block > pre,
.raw-block > .attachment,
.raw-block > details,
.raw-block > p,
.json-panel {
  margin: 0 8px 8px;
}

.json-view,
.text-view {
  max-height: 28em;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
}

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

.attachment {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.thumb {
  max-width: 160px;
  max-height: 160px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: zoom-in;
}

.thumb-large {
  max-width: 100%;
  max-height: none;
  cursor: zoom-out;
}

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

.thinking-text {
  padding: 6px 0;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.live-text {
  padding: 6px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: calc(1.5em + 12px);
}

.live-blocks .block:last-child .live-text::after {
  content: "\258d";
  color: var(--accent);
  animation: pulse 1s steps(2) infinite;
}

.citations {
  display: block;
  padding: 0 8px 6px;
  font-size: 12px;
  color: var(--muted);
}

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

/* Run bar */

.runbar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.runbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px var(--gutter);
}

.run-status {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.run-status[data-status="failed"],
.run-status[data-status="problem"],
.run-status[data-status="interrupted"] {
  color: var(--danger);
}

.run-status[data-status="streaming"],
.run-status[data-status="pending"] {
  color: var(--accent);
}

.run-status[data-status="retrying"] {
  color: var(--warn);
}

.token-count {
  font-size: 13px;
  color: var(--muted);
}

.token-count[data-state="failed"] {
  color: var(--danger);
}

/* Menu */

.menu {
  position: relative;
}

.menu > summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.menu-items > button,
.menu-items > a {
  justify-content: flex-start;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}

.menu-items > button.danger {
  color: var(--danger);
}

.menu-items > button:hover,
.menu-items > a:hover {
  background: var(--surface);
}

/* Dialogs and panels */

.dialog {
  width: min(720px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 2 * var(--gutter));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog.panel {
  width: min(1000px, calc(100vw - 2 * var(--gutter)));
}

.dialog::backdrop {
  background: rgb(0 0 0 / 45%);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.dialog-head h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.dialog-actions a {
  margin-right: auto;
}

.dialog-foot {
  margin: 12px 0 0;
  font-size: 13px;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  white-space: normal;
  text-align: left;
}

.picker-preview {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-text {
  max-height: 50vh;
  overflow: auto;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
}

.panel-section {
  margin-top: 16px;
}

.panel-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.panel-section-head h3 {
  margin: 0 auto 0 0;
}

.panel-section > h3 {
  margin: 0 0 6px;
}

.error-section p {
  color: var(--danger);
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 12px;
  margin: 0;
  font-size: 14px;
}

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

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Toasts */

.toasts {
  position: fixed;
  right: var(--gutter);
  bottom: 72px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 2 * var(--gutter)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.toast-error {
  border-color: var(--error-border);
  background: var(--error-bg);
}

.toast-text {
  flex: 1 1 auto;
  min-width: 0;
}

.toast-close {
  min-height: 0;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-size: 16px;
}

/* Component library */

.library {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.comp-row {
  border-bottom: 1px solid var(--border);
}

.comp-link {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.comp-link[aria-current="page"] {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
}

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

.comp-meta {
  font-size: 12px;
  color: var(--muted);
}

.component-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.component-editor h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

textarea.component-editor-text {
  min-height: 8em;
}

.editor-actions .save-state {
  font-size: 13px;
}

.detail-section h3 {
  margin: 12px 0 6px;
}

.usage-list li {
  padding: 2px 0;
}

.revision {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.revision-head {
  font-size: 14px;
}

.revision-text {
  max-height: 8em;
  margin: 6px 0;
  overflow: auto;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--surface);
  font: 13px/1.45 var(--font);
}

.placeholder {
  padding: 24px 0;
}

/* Settings */

.settings-page-section {
  margin: 0 0 32px;
}

.settings-page-section > h2 {
  margin: 0 0 6px;
}

.device-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.device-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.device-meta,
.device-agent {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.device-row input {
  flex: 1 1 200px;
}

.pairing {
  margin-top: 12px;
}

.pairing-code {
  margin: 4px 0;
  font: 600 28px/1.2 var(--mono);
  letter-spacing: 0.08em;
}

.pairing-expiry {
  font-size: 13px;
  color: var(--muted);
}

/* Enrollment */

.enroll-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enroll-form button {
  align-self: flex-start;
}

/* Phone width */

@media (max-width: 640px) {
  body {
    font-size: 16px;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  .topbar {
    gap: 6px 12px;
  }

  .page-conversation .title-input {
    order: 3;
    flex-basis: 100%;
  }

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

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

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

  .runbar-inner {
    gap: 6px;
  }

  .runbar-inner button {
    padding: 4px 10px;
  }

  .run-status {
    flex-basis: 100%;
    order: 5;
  }

  .toasts {
    left: var(--gutter);
    right: var(--gutter);
    max-width: none;
  }

  .conv-row {
    align-items: flex-start;
  }

  .conv-row > button {
    margin-top: 8px;
  }

  .trash-row {
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .running-badge::before,
  .live-blocks .block:last-child .live-text::after {
    animation: none;
  }
}

.picker-entry {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.picker-entry > .link {
  align-self: flex-start;
}

.picker-preview.picker-full {
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
