/* Components. One block per component, in the order of web/js/components. */

/* ----------------------------------------------------------------- button */
/* Mono caps, square, no icons beside labels. Primary is a green tint, not a solid slab. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 30px; padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--text-strong);
  font-family: var(--font-mono); font-size: var(--text-label); font-weight: 400;
  text-transform: uppercase; letter-spacing: var(--label-tracking); line-height: 1;
  white-space: nowrap; text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--text-faint); }
.btn:active { background: var(--active); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; border-color: var(--rule-strong); }
.btn svg { flex: none; }
.btn--primary { background: var(--accent-tint); border-color: transparent; color: var(--accent-text); }
.btn--primary:hover { background: var(--accent-tint-hover); border-color: transparent; }
.btn--primary:disabled:hover { background: var(--accent-tint); border-color: transparent; }
.btn--ghost { border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { border-color: transparent; color: var(--text-strong); }
.btn--danger { background: var(--red-tint); border-color: transparent; color: var(--red-text); }
.btn--danger:hover { background: color-mix(in srgb, var(--red-tint) 70%, var(--red) 30%); border-color: transparent; }
.btn--sm { height: 26px; padding: 0 10px; font-size: 10.5px; }
.btn--lg { height: 36px; padding: 0 16px; }
.btn--icon { width: 30px; padding: 0; color: var(--text-muted); }
.btn--icon.btn--sm { width: 26px; }
.btn--block { width: 100%; }
.btn__hint { color: inherit; opacity: .6; }

/* -------------------------------------------------------------------- tag */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 18px; padding: 0 5px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--label-tracking);
  white-space: nowrap; line-height: 1;
  background: var(--gray-tint); color: var(--text-muted);
}
.tag--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--rule-strong); }
.tag--accent, .tag--green { background: var(--accent-tint); color: var(--accent-text); }
.tag--amber { background: var(--amber-tint); color: var(--amber-text); }
.tag--red { background: var(--red-tint); color: var(--red-text); }
.tag--blue { background: var(--blue-tint); color: var(--blue-text); }

/* A status mark: a small square. Live ones blink like a cursor. */
.mark { width: 6px; height: 6px; background: currentColor; flex: none; display: inline-block; }
.mark--gray { color: var(--rule-strong); }
.mark--green, .mark--accent { color: var(--accent); }
.mark--amber { color: var(--amber); }
.mark--red { color: var(--red); }
.mark--blue { color: var(--blue); }
.mark--live { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .15; } }

/* ------------------------------------------------------------------ panel */
.panel { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--bg-raised); }
.panel__header { display: flex; align-items: center; gap: var(--s-3); min-height: 40px; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--rule); }
.panel__title { font-size: var(--text-base); color: var(--text-strong); }
.panel__description { font-size: var(--text-md); color: var(--text-muted); }
.panel__body { padding: var(--s-5); }
.panel__footer { display: flex; align-items: center; gap: var(--s-2); justify-content: flex-end; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--rule); }
.panel + .panel { margin-top: var(--s-4); }

/* ------------------------------------------------------------------ table */
.table-wrap { border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: auto; background: var(--bg-raised); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.table th {
  text-align: left; height: 34px; padding: 0 var(--s-4);
  font-family: var(--font-mono); font-size: var(--text-label); font-weight: 400; text-transform: uppercase; letter-spacing: var(--label-tracking);
  color: var(--text-faint); border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.table td { height: var(--row-h); padding: 8px var(--s-4); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table th + th, .table td + td { border-left: 1px solid var(--rule); }
.table tr:last-child td { border-bottom: 0; }
.table td.is-top { vertical-align: top; padding-top: 12px; }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr.is-link:hover td { background: var(--hover); }
.table a.cell-link { color: var(--text-strong); text-decoration: none; }
.table tr.is-link:hover a.cell-link { text-decoration: underline; text-decoration-color: var(--text-faint); }
.table .cell-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.table .cell-shrink { width: 1%; white-space: nowrap; }
@media (max-width: 760px) { .table .hide-sm { display: none; } }

/* ------------------------------------------------------------------- rows */
/* Hairline-separated rows for short lists: the inspector, the repo picker, settings. */
.rows { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--bg-raised); overflow: hidden; }
.rows--bare { border: 0; background: none; border-radius: 0; }
.rowitem {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--row-h); padding: 8px var(--s-4);
  border-bottom: 1px solid var(--rule);
  color: var(--text); text-decoration: none;
}
.rowitem:last-child { border-bottom: 0; }
a.rowitem:hover, button.rowitem:hover { background: var(--hover); }
button.rowitem { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; }
.rows--bare .rowitem { padding-left: 0; padding-right: 0; }
.rows--bare a.rowitem:hover { background: none; }
.rows--bare a.rowitem:hover .rowitem__title { text-decoration: underline; text-decoration-color: var(--text-faint); text-underline-offset: 3px; }
.rowitem__lead { flex: none; display: grid; place-items: center; width: 14px; color: var(--text-faint); }
.rowitem__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rowitem__title { font-size: var(--text-md); color: var(--text-strong); }
.rowitem__meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.rowitem__trail { flex: none; display: flex; align-items: center; gap: var(--s-2); color: var(--text-faint); font-size: var(--text-sm); }
.rowitem.is-selected { background: var(--accent-tint); }
.rowitem.is-selected .rowitem__title { color: var(--accent-text); }

/* --------------------------------------------------------------------- kv */
.kv { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 10px var(--s-5); font-size: var(--text-md); align-items: baseline; }
.kv dt { font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--label-tracking); color: var(--text-faint); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; color: var(--text-strong); }

/* ---------------------------------------------------------------- readout */
/* Counters as one instrument strip, not a row of cards. */
.readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--bg-raised); }
.readout__cell { padding: var(--s-4) var(--s-5); border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.readout__cell:last-child { border-right: 0; }
.readout__value { font-family: var(--font-mono); font-size: var(--text-2xl); line-height: 1; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.readout__cell.is-alert .readout__value { color: var(--amber-text); }
.readout__hint { font-size: var(--text-sm); color: var(--text-faint); }
@media (max-width: 760px) { .readout { grid-template-columns: 1fr 1fr; } .readout__cell:nth-child(2n) { border-right: 0; } .readout__cell:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); } }

/* ------------------------------------------------------------------- tabs */
.tabs { display: flex; gap: var(--s-6); border-bottom: 1px solid var(--rule); padding: 0 var(--s-8); flex: none; overflow-x: auto; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0;
  border: 0; background: none; color: var(--text-faint);
  font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--label-tracking); white-space: nowrap;
}
.tab:hover { color: var(--text-strong); }
.tab.is-active { color: var(--text-strong); }
.tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--accent); }
.tab__count { color: var(--text-faint); }

/* ----------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__hint { font-size: var(--text-sm); color: var(--text-faint); }
.input, .textarea {
  width: 100%;
  border: 1px solid var(--rule-strong);
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  padding: 0 10px; height: 32px;
  font-size: var(--text-md); color: var(--text-strong);
  transition: border-color var(--dur) var(--ease);
}
.textarea { padding: 8px 10px; height: auto; resize: vertical; line-height: 1.5; }
.input:hover, .textarea:hover { border-color: var(--text-faint); }
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: none; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input-group { display: flex; gap: var(--s-2); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search .input { padding-left: 34px; }

/* ----------------------------------------------------------------- switch */
.switch { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; user-select: none; font-size: var(--text-md); color: var(--text-strong); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { position: relative; width: 28px; height: 16px; border-radius: var(--radius-md); background: var(--bg-sunken); box-shadow: inset 0 0 0 1px var(--rule-strong); flex: none; transition: background var(--dur) var(--ease); }
.switch__track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 10px; height: 10px; border-radius: var(--radius-sm); background: var(--text-faint); transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.switch input:checked + .switch__track { background: var(--accent-tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
.switch input:checked + .switch__track::after { transform: translateX(12px); background: var(--accent); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus); }

/* ----------------------------------------------------------------- avatar */
.avatar { border-radius: var(--radius-md); flex: none; object-fit: cover; display: inline-grid; place-items: center; font-family: var(--font-mono); color: var(--text-strong); background: var(--active); overflow: hidden; }
.avatar--warn { background: var(--amber-tint); color: var(--amber-text); }

/* ---------------------------------------------------------------- callout */
.callout { display: flex; flex-direction: column; gap: 4px; padding: var(--s-3) var(--s-4); border-left: 2px solid var(--rule-strong); background: var(--bg-raised); font-size: var(--text-md); color: var(--text); }
.callout + .callout { margin-top: var(--s-2); }
.callout .label { color: inherit; }
.callout--info { border-color: var(--blue); }
.callout--info > .label { color: var(--blue-text); }
.callout--warn, .callout--question { border-color: var(--amber); background: color-mix(in srgb, var(--amber-tint) 60%, var(--bg-raised)); }
.callout--warn > .label, .callout--question > .label { color: var(--amber-text); }
.callout--danger { border-color: var(--red); background: color-mix(in srgb, var(--red-tint) 60%, var(--bg-raised)); }
.callout--danger > .label { color: var(--red-text); }
.callout a { color: inherit; }

/* ------------------------------------------------------------------ empty */
.empty { display: flex; flex-direction: column; gap: 4px; padding: var(--s-5); }
.empty__title { color: var(--text-strong); }
.empty__text { font-size: var(--text-md); color: var(--text-muted); max-width: 520px; }
.empty__actions { margin-top: var(--s-3); display: flex; gap: var(--s-2); }
.empty--boxed { border: 1px dashed var(--rule-strong); border-radius: var(--radius-lg); }

/* ------------------------------------------------------------------ steps */
.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--rule); align-items: center; }
.step:last-child { border-bottom: 0; }
.step__num { font-family: var(--font-mono); font-size: var(--text-md); color: var(--text-faint); }
.step.is-done .step__num { color: var(--accent-text); }
.step.is-current .step__num { color: var(--text-strong); }
.step.is-done .step__title { color: var(--text-muted); }
.step__title { color: var(--text-strong); }
.step__text { font-size: var(--text-md); color: var(--text-muted); margin-top: 2px; }

/* --------------------------------------------------------------- composer */
/* A terminal prompt. ::before is a glow that follows the pointer along the border;
   ::after is a band of light orbiting the border while the field has focus. */
@property --orbit { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.composer { position: relative; border: 1px solid var(--rule-strong); background: var(--bg-raised); border-radius: var(--radius-lg); --mx: 50%; --my: 50%; }
.composer::before, .composer::after {
  content: ""; position: absolute; inset: -1px; padding: 1px; border-radius: inherit; pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
  opacity: 0; transition: opacity 260ms var(--ease);
}
.composer::before { background: radial-gradient(200px circle at var(--mx) var(--my), var(--accent), transparent 70%); }
.composer::after { background: conic-gradient(from var(--orbit), transparent 0deg 280deg, color-mix(in srgb, var(--accent) 40%, transparent) 320deg, var(--accent) 352deg, transparent 360deg); animation: orbit 3.6s linear infinite; }
.composer:hover::before { opacity: .7; }
.composer:focus-within::after { opacity: 1; }
.composer.is-disabled::before, .composer.is-disabled::after { display: none; }
@keyframes orbit { to { --orbit: 360deg; } }

.composer__field { display: grid; grid-template-columns: 32px minmax(0, 1fr); }
.composer__prompt { font-family: var(--font-mono); font-size: var(--text-lg); line-height: 1.55; color: var(--text-faint); text-align: right; padding: 11px 10px 0 0; transition: color var(--dur) var(--ease); }
.composer:focus-within .composer__prompt { color: var(--accent-text); }
.composer__input { position: relative; min-width: 0; }
.composer textarea { display: block; width: 100%; border: 0; background: none; resize: none; outline: none; min-height: 48px; max-height: 240px; line-height: 1.55; font-size: var(--text-base); padding: 12px var(--s-4) 8px 0; color: var(--text-strong); caret-color: var(--accent); }
.composer textarea:focus-visible { box-shadow: none; }
.composer__ghost { position: absolute; inset: 0; padding: 12px var(--s-4) 8px 0; line-height: 1.55; font-size: var(--text-base); color: var(--text-faint); pointer-events: none; white-space: pre-wrap; overflow: hidden; }
.composer__ghost::after { content: ""; display: inline-block; width: .55em; height: 1.15em; margin-left: 2px; vertical-align: -.2em; background: var(--accent); animation: blink 1.05s steps(1) infinite; }
.composer:focus-within .composer__ghost::after { opacity: .35; }
.composer.is-disabled .composer__ghost::after { display: none; }
.composer__file { display: none; }
.composer__attachments { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-3) var(--s-3) 0 32px; }
.composer__attachment { position: relative; width: 88px; height: 64px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-sunken); }
.composer__attachment img { display: block; width: 100%; height: 100%; object-fit: cover; }
.composer__remove { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--bg-raised); color: var(--text-strong); }
.composer__remove:hover { color: var(--red-text); border-color: var(--red); }
.images { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.images__button { position: relative; display: block; max-width: 100%; padding: 0; border: 0; border-radius: var(--radius-md); background: none; cursor: zoom-in; }
.images__image { display: block; max-width: min(100%, 480px); max-height: 360px; width: auto; height: auto; object-fit: contain; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--bg-sunken); transition: border-color var(--dur) var(--ease); }
.images__button:hover .images__image { border-color: var(--text-faint); }
.images__zoom { position: absolute; right: 7px; bottom: 7px; display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-raised); color: var(--text-strong); opacity: 0; transition: opacity var(--dur) var(--ease); pointer-events: none; }
.images__button:hover .images__zoom, .images__button:focus-visible .images__zoom { opacity: 1; }
.image-preview { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; padding: var(--s-4); background: color-mix(in srgb, var(--bg-sunken) 88%, transparent); backdrop-filter: blur(8px); animation: fade 120ms var(--ease); }
.image-preview__bar { display: flex; align-items: center; gap: var(--s-3); min-height: 40px; flex: none; color: var(--text-muted); }
.image-preview__count { font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--label-tracking); color: var(--text-strong); }
.image-preview__hint { font-size: var(--text-sm); color: var(--text-faint); }
.image-preview__close, .image-preview__nav { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-raised); color: var(--text-strong); }
.image-preview__close { margin-left: auto; }
.image-preview__close:hover, .image-preview__nav:hover { background: var(--hover); border-color: var(--text-faint); }
.image-preview__body { position: relative; display: grid; place-items: center; flex: 1; min-height: 0; }
.image-preview__image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-sunken); box-shadow: var(--shadow-pop); user-select: none; }
.image-preview__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.image-preview__nav--previous { left: var(--s-3); }
.image-preview__nav--previous svg { transform: rotate(180deg); }
.image-preview__nav--next { right: var(--s-3); }
@media (max-width: 760px) { .image-preview { padding: var(--s-2); } .image-preview__hint { display: none; } .image-preview__nav--previous { left: var(--s-1); } .image-preview__nav--next { right: var(--s-1); } }

.composer__bar { display: flex; align-items: center; gap: var(--s-3); padding: 6px 6px 6px 32px; border-top: 1px dashed var(--rule); }
.composer__meta, .composer__hint { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: var(--label-tracking); color: var(--text-faint); white-space: nowrap; }
.composer__meta { min-width: 0; }
.composer__to { color: var(--accent-text); }
.composer__count { font-variant-numeric: tabular-nums; }
.composer__hint { display: inline-flex; align-items: center; gap: 3px; }
.composer.is-disabled { opacity: .55; }
@media (max-width: 760px) { .composer__hint, .composer__count { display: none; } .composer__field { grid-template-columns: 24px minmax(0, 1fr); } .composer__attachments { padding-left: 24px; } .composer__bar { padding-left: 24px; } }

/* The send button is a keycap: it sits on a 2px edge and goes down when pressed (or on Enter). */
.sendkey {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 6px 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--radius-md);
  background: var(--accent-tint); color: var(--accent-text);
  font: 400 var(--text-label)/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  box-shadow: 0 2px 0 0 color-mix(in srgb, var(--accent) 50%, var(--bg));
  transform: translateY(-1px);
  transition: transform 70ms ease-out, box-shadow 70ms ease-out, background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sendkey:hover { background: var(--accent-tint-hover); }
.sendkey:active, .sendkey.is-pressed { transform: translateY(1px); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, var(--bg)); }
.sendkey__label { position: relative; font-variant-numeric: tabular-nums; }
.sendkey__glyph { position: relative; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid currentColor; border-radius: 1px; font-size: 11px; opacity: .75; }
.sendkey:disabled { background: transparent; color: var(--text-faint); border-color: var(--rule-strong); box-shadow: 0 2px 0 0 var(--rule); cursor: not-allowed; }
.sendkey.is-sending::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, transparent 0 5px, color-mix(in srgb, var(--accent) 22%, transparent) 5px 10px); background-size: 14.14px 14.14px; animation: stripes .5s linear infinite; }
.sendkey.is-sent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
@keyframes stripes { to { background-position: 14.14px 0; } }
@media (prefers-reduced-motion: reduce) { .composer::after, .sendkey.is-sending::before, .composer__ghost::after { animation: none; } }
.dock { flex: none; padding: 0 var(--s-8) var(--s-5); }
.dock > * { max-width: var(--reading-w); }

/* -------------------------------------------------------------------- log */
/* A repository's conversation reads as a log: who and when in a gutter, the text beside it, rules between. */
.log { max-width: calc(var(--reading-w) + var(--s-8) * 2); padding: var(--s-6) var(--s-8); }
.entry { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s-5); padding: var(--s-4) 0; border-top: 1px solid var(--rule); }
.entry:first-child { border-top: 0; }
.entry__who { display: flex; flex-direction: column; gap: 3px; padding-top: 3px; min-width: 0; }
.entry__author { font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--label-tracking); color: var(--text-strong); }
.entry--agent .entry__author { color: var(--accent-text); }
.entry__time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.entry__text { color: var(--text-strong); min-width: 0; }
.entry--agent .entry__text { color: var(--text); }
.entry__status { margin-top: var(--s-3); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--text-sm); color: var(--text-muted); }
.entry__status a { color: var(--text-strong); }
@media (max-width: 760px) {
  .log { padding: var(--s-2) var(--s-4); }
  .dock { padding: 0 var(--s-3) var(--s-3); }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .entry__who { flex-direction: row; gap: var(--s-2); align-items: baseline; padding-top: 0; }
}

/* ------------------------------------------------------------- transcript */
.stage-summary { display: flex; align-items: flex-start; gap: var(--s-3); margin-top: var(--s-5); padding: var(--s-3) var(--s-4); border-left: 2px solid var(--rule-strong); background: var(--bg-raised); }
.stage-summary .tag { flex: none; margin-top: 2px; }
.stage-summary__description { color: var(--text-muted); font-size: var(--text-md); }
.stage-summary--green, .stage-summary--accent { border-left-color: var(--accent); }
.stage-summary--blue { border-left-color: var(--blue); }
.stage-summary--amber { border-left-color: var(--amber); }
.stage-summary--red { border-left-color: var(--red); }
.transcript { display: flex; flex-direction: column; gap: var(--s-5); font-size: var(--text-md); }
.tx-head { display: flex; gap: var(--s-3); align-items: center; }
.tx-input { border-left: 1px solid var(--rule-strong); padding: 2px 0 2px var(--s-3); }
.tx-input pre.tx-input__text { margin: 6px 0 0; background: none; border: 0; padding: 0; color: var(--text-muted); max-height: 260px; }
.tx-input:has(.structured) { border-left: 0; padding-left: 0; }
.tx-input:has(.structured) > .tx-head { margin-bottom: 6px; }
.tx-agent { display: flex; flex-direction: column; gap: var(--s-2); }
.tx-agent > .tx-head > .label:first-child { color: var(--accent-text); }
.tx-thinking { color: var(--text-faint); border-left: 1px solid var(--rule); padding-left: var(--s-3); white-space: pre-wrap; font-size: var(--text-sm); }
.tx-tool { border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--bg-raised); overflow: hidden; }
.tx-tool > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-2); height: 32px; padding: 0 10px; font-family: var(--font-mono); font-size: var(--text-sm); }
.tx-tool > summary::-webkit-details-marker { display: none; }
.tx-tool > summary:hover { background: var(--hover); }
.tx-tool__chev { transition: transform var(--dur) var(--ease); color: var(--text-faint); flex: none; }
.tx-tool[open] .tx-tool__chev { transform: rotate(90deg); }
.tx-tool__name { color: var(--text-strong); flex: none; }
.tx-tool__args { color: var(--text-faint); }
.tx-tool__state { margin-left: auto; flex: none; display: flex; }
.tx-tool__body { border-top: 1px solid var(--rule); padding: var(--s-3); }
.tx-tool__body pre { margin: 6px 0 var(--s-3); max-height: 320px; }
.tx-tool.is-error .tx-tool__name { color: var(--red-text); }
.tx-error { color: var(--red-text); }
.tx-live { border-left: 1px solid var(--accent); padding-left: var(--s-3); }

/* Structured worker input: the readable request first, protocol details on demand. */
.structured { overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--bg-raised); }
.structured--nested { margin: var(--s-2) 0; background: var(--bg); }
.structured__header { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-4); border-bottom: 1px solid var(--rule); }
.structured__title { margin-top: 4px; font-size: var(--text-lg); overflow-wrap: anywhere; }
.structured__header > .tag { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.structured__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border-bottom: 1px solid var(--rule); }
.structured__fact { min-width: 0; padding: var(--s-3) var(--s-4); border-right: 1px solid var(--rule); }
.structured__fact:last-child { border-right: 0; }
.structured__value { margin-top: 4px; color: var(--text-strong); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.structured__section { padding: var(--s-4); }
.structured__section + .structured__section { border-top: 1px solid var(--rule); }
.structured__request { margin-top: var(--s-2); color: var(--text-strong); }
.structured__empty { color: var(--text-faint); font-size: var(--text-md); }
.structured__note { display: flex; flex-direction: column; gap: 4px; margin: 0 var(--s-4) var(--s-3); padding: var(--s-3); border-left: 2px solid var(--blue); background: var(--blue-tint); color: var(--text); font-size: var(--text-md); }
.structured__note > .label { color: var(--blue-text); }
.structured__raw, .structured__batch { border-top: 1px solid var(--rule); }
.structured__raw > summary, .structured__batch > summary { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 var(--s-4); cursor: pointer; list-style: none; color: var(--text-faint); font-family: var(--font-mono); font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--label-tracking); }
.structured__raw > summary::-webkit-details-marker, .structured__batch > summary::-webkit-details-marker { display: none; }
.structured__raw > summary:hover, .structured__batch > summary:hover { background: var(--hover); color: var(--text-strong); }
.structured__raw > summary svg { transition: transform var(--dur) var(--ease); }
.structured__raw[open] > summary svg { transform: rotate(90deg); }
.structured__raw > pre, .structured__batch > pre { max-height: 320px; margin: 0; border: 0; border-top: 1px solid var(--rule); border-radius: 0; }
@media (max-width: 760px) { .structured__facts { grid-template-columns: 1fr 1fr; } .structured__fact:nth-child(2n) { border-right: 0; } .structured__fact:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); } .stage-summary { flex-direction: column; gap: var(--s-2); } }

/* ------------------------------------------------------------- repo picker */
.picker { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--bg-raised); overflow: hidden; }
.picker__search { border-bottom: 1px solid var(--rule); }
.picker__search .input { border: 0; border-radius: 0; height: 44px; padding-left: 38px; background: transparent; }
.picker__search svg { left: 14px; }
.picker__list { max-height: 352px; overflow-y: auto; }

/* ----------------------------------------------------------------- method */
.method__body { display: flex; flex-direction: column; gap: var(--s-4); }
.method__text { font-size: var(--text-md); color: var(--text-muted); }
.device-code { font: 400 32px/1 var(--font-mono); letter-spacing: .2em; color: var(--text-strong); }

/* --------------------------------------------------------------- settings */
.settings-group { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-8); padding: var(--s-6) 0; border-top: 1px solid var(--rule); }
.settings-group__title { color: var(--text-strong); }
.settings-group__text { font-size: var(--text-md); color: var(--text-muted); margin-top: 4px; }
@media (max-width: 760px) { .settings-group { grid-template-columns: 1fr; gap: var(--s-3); } }

/* ------------------------------------------------------------ toast, dialog */
.toasts { position: fixed; right: var(--s-5); bottom: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); z-index: 60; }
.toast { display: flex; gap: var(--s-3); align-items: center; width: 360px; max-width: calc(100vw - 32px); padding: 8px 8px 8px var(--s-4); background: var(--bg-raised); border-left: 2px solid var(--text-faint); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size: var(--text-md); color: var(--text-strong); animation: rise 160ms var(--ease); }
.toast--error { border-left-color: var(--red); }
.toast--success { border-left-color: var(--accent); }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }
.dialog-backdrop { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 70; animation: fade 120ms var(--ease); padding: var(--s-4); }
@keyframes fade { from { opacity: 0; } }
.dialog { width: 440px; max-width: 100%; background: var(--bg-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); animation: rise 160ms var(--ease); }
.dialog__head { height: 40px; display: flex; align-items: center; padding: 0 var(--s-5); border-bottom: 1px solid var(--rule); }
.dialog__body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.dialog__title { font-size: var(--text-lg); color: var(--text-strong); }
.dialog__text { color: var(--text-muted); font-size: var(--text-md); }
.dialog__actions { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--rule); }

/* --------------------------------------------------------------- spinner */
.spinner { width: 10px; height: 10px; border: 1.5px solid var(--rule-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- timeline */
.timeline { display: flex; flex-direction: column; }
.timeline__item { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s-5); padding: var(--s-4) 0; border-top: 1px solid var(--rule); }
.timeline__item:first-child { border-top: 0; padding-top: 0; }
.timeline__head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.timeline .tx-input__text { margin: 0; }
@media (max-width: 760px) { .timeline__item { grid-template-columns: 1fr; gap: 6px; } .timeline__head { flex-direction: row; } }

/* ------------------------------------------------------------ sign-in */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); background: var(--bg); }
.login__box { width: 100%; max-width: 380px; }
.login__brand { display: flex; align-items: center; gap: var(--s-3); color: var(--accent); margin-bottom: var(--s-8); }
.login__brand .label { color: var(--text-faint); }
.login__title { margin: 0 0 var(--s-2); font-size: var(--text-2xl); font-weight: 400; color: var(--text-strong); letter-spacing: -.01em; }
.login__text { margin: 0 0 var(--s-6); color: var(--text-muted); font-size: var(--text-md); }
.login__status { min-height: 40px; margin-top: var(--s-4); display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--text-md); }
.login__error { color: var(--red-text); }

.otp { position: relative; display: grid; grid-template-columns: repeat(3, 1fr) var(--s-1) repeat(3, 1fr); gap: var(--s-2); cursor: text; }
.otp__cell {
  height: 56px; display: grid; place-items: center;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--bg-sunken);
  font: 500 24px/1 var(--font-mono); color: var(--text-strong);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
/* A gap after the third digit, as the apps show the code. */
.otp__cell:nth-child(4) { grid-column: 5; }
.otp__cell.is-filled { border-color: var(--text-faint); }
.otp__cell.is-current { border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.otp__cell.is-current::after { content: ""; width: 2px; height: 26px; background: var(--accent); animation: otp-blink 1s steps(1) infinite; }
.otp.is-wrong .otp__cell { border-color: var(--red); }
.otp.is-wrong { animation: otp-shake .32s var(--ease); }
.otp.is-locked .otp__cell { opacity: .45; }
/* The real input lies over the cells, transparent, so typing, pasting and password managers all reach it. */
.otp__input {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; margin: 0;
  background: transparent; color: transparent; caret-color: transparent; font-size: 16px; letter-spacing: 2em; outline: none;
}
.otp__input::selection { background: transparent; }
@keyframes otp-blink { 50% { opacity: 0; } }
@keyframes otp-shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .otp.is-wrong, .otp__cell.is-current::after { animation: none; } }
