/* Shared surfaces, accessible controls and transcript rendering. Chat layout lives in chat.css. */
:root {
  color-scheme: light dark;
  --font:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --bg: light-dark(#faf9f6, #1b1d1c);
  --sidebar: light-dark(#f0efeb, #171918);
  --composer: light-dark(#ffffff, #262927);
  --bg-subtle: light-dark(#f4f3ef, #202321);
  --bg-raised: light-dark(#ffffff, #282c29);
  --bg-hover: light-dark(rgb(0 0 0 / 0.05), rgb(255 255 255 / 0.06));
  --bg-active: light-dark(rgb(0 0 0 / 0.09), rgb(255 255 255 / 0.1));
  --accent-soft: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
  --line: light-dark(#e5e5de, #333832);
  --line-strong: light-dark(#d0d3c9, #495047);
  --text: light-dark(#222b24, #eeeee8);
  --text-2: light-dark(#59645a, #b5bdb3);
  --text-3: light-dark(#656e64, #9da69a);
  --accent: light-dark(#356447, #afccb3);
  --primary: light-dark(#315c43, #b4cfb7);
  --on-primary: light-dark(#faf9f6, #1b1d1c);
  --user-bg: light-dark(#edeee8, #2b302b);
  --danger: light-dark(#bf3022, #ff9485);
  --danger-bg: light-dark(#fdf1ef, #301c19);
  --warn: light-dark(#8b5b00, #e9b649);
  --warn-bg: light-dark(#fdf7e6, #2a2210);
  --ok: light-dark(#187545, #5ccf8a);
  --live: var(--accent);
  --tip-bg: light-dark(#252525, #eeeeee);
  --tip-fg: light-dark(#fafafa, #171717);
  --shadow: 0 2px 8px rgb(0 0 0 / 0.08);
  --shadow-pop: 0 16px 48px rgb(0 0 0 / 0.25);
  --target: 32px;
  --column: 760px;
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}
@media (pointer: coarse) {
  :root {
    --target: 44px;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p,
dl,
dd,
figure {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
code,
pre,
kbd {
  font-family: var(--mono);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Icons */
.icon {
  display: inline-flex;
  flex: none;
  width: 16px;
  height: 16px;
}
.icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.8;
}
.icon:empty {
  display: none;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: max(36px, var(--target));
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg-raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color 0.12s,
    border-color 0.12s,
    opacity 0.12s;
}
.button:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-3);
}
.button.primary {
  border-color: transparent;
  background: var(--primary);
  color: var(--on-primary);
}
.button.primary:hover:not(:disabled) {
  border-color: transparent;
  background: color-mix(in srgb, var(--primary) 86%, var(--bg));
}
.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}
.button.ghost:hover:not(:disabled) {
  border-color: transparent;
  color: var(--text);
}
.button.danger {
  color: var(--danger);
}
.button.danger:hover:not(:disabled) {
  background: var(--danger-bg);
}
.button.small {
  min-height: max(32px, var(--target));
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}
.button:disabled {
  border-color: var(--line);
  background: var(--bg-subtle);
  color: var(--text-3);
}
.button.ghost:disabled {
  border-color: transparent;
  background: transparent;
  opacity: 0.6;
}
.button:active:not(:disabled),
.icon-button:active:not(:disabled) {
  background: var(--bg-active);
}
.button.primary:active:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 80%, var(--text));
}
.button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
}
.button[aria-busy="true"]::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.button.block {
  width: 100%;
}
.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--target);
  height: var(--target);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  transition:
    background-color 0.12s,
    color 0.12s;
}
.icon-button:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}
.icon-button[aria-pressed="true"],
.icon-button[aria-expanded="true"] {
  background: var(--bg-active);
  color: var(--text);
}
.icon-button:disabled {
  opacity: 0.4;
}
.icon-button.small {
  width: var(--target);
  height: var(--target);
  border-radius: 8px;
}
.icon-button.small .icon {
  width: 15px;
  height: 15px;
}
@media (pointer: coarse) {
  .icon-button.small,
  .button.small {
    min-width: 44px;
    min-height: 44px;
  }
  .icon-button.small {
    width: 44px;
    height: 44px;
  }
}
[data-state="done"] {
  color: var(--ok) !important;
}
[data-state="failed"] {
  color: var(--danger) !important;
}

/* Quiet disclosures share one chevron; their entire label remains a target. */
.device-tools > summary,
.model-info > summary,
.connection-scopes > summary,
.key-recovery > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: var(--target);
  list-style: none;
}
.device-tools > summary::-webkit-details-marker,
.model-info > summary::-webkit-details-marker,
.connection-scopes > summary::-webkit-details-marker {
  display: none;
}
.device-tools > summary::before,
.model-info > summary::before,
.connection-scopes > summary::before,
.key-recovery > summary::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-inline: 2px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  rotate: -45deg;
}
.device-tools[open] > summary::before,
.model-info[open] > summary::before,
.connection-scopes[open] > summary::before,
.key-recovery[open] > summary::before {
  rotate: 45deg;
}

/* Native tooltip popover lives above clipping and scrolling surfaces. */
#control-tooltip {
  position: fixed;
  inset: auto;
  margin: 0;
  width: max-content;
  max-width: min(320px, calc(100vw - 16px));
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: var(--tip-bg);
  color: var(--tip-fg);
  font: 500 12px/1.4 var(--font);
  text-align: center;
  white-space: normal;
  pointer-events: none;
  box-shadow: var(--shadow);
}

/* Form controls */
.input,
.select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg-raised);
  color: var(--text);
  font-size: 15px;
}
.input:focus,
.select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}
.input:disabled,
.select:disabled {
  background: var(--bg-subtle);
  color: var(--text-3);
}
.select:disabled {
  opacity: 0.7;
}
.label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
}
.hint {
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.55;
}

/* Motion */
.spinner {
  display: inline-block;
  flex: none;
  width: 13px;
  height: 13px;
  border: 1.75px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
}
.dot.live {
  background: var(--live);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent);
  animation: pulse 1.8s ease-out infinite;
}
.dot.ok {
  background: var(--ok);
}
.dot.danger {
  background: var(--danger);
}
.dot.warn {
  background: var(--warn);
}
@keyframes spin {
  to {
    rotate: 360deg;
  }
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 6px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
  }
}

/* Brand and top bar */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 620;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--on-primary);
  font: 600 15px/1 var(--font);
}
.brand-mark.large {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 24px;
}
.crumb {
  color: var(--text-3);
  font-weight: 500;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 52px;
  padding: 0 10px 0 16px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar .spacer {
  flex: 1;
}
.topbar .divider {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--line);
}

/* Sign in */
.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(32px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: radial-gradient(
    ellipse at 50% 20%,
    color-mix(in srgb, var(--accent) 7%, var(--bg)),
    var(--bg) 65%
  );
}
.login-card {
  width: min(100%, 360px);
  padding-bottom: 24px;
}
.login .brand-mark.large {
  width: 48px;
  height: 48px;
  margin-bottom: 32px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  color: var(--accent);
}
.login h1 {
  margin-top: 28px;
  font-size: 40px;
  font-weight: 550;
  line-height: 1.12;
  letter-spacing: -1.5px;
}
.login .lede {
  margin-top: 18px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.65;
  max-width: 340px;
}
.login form {
  margin-top: 28px;
}
.secret-field {
  position: relative;
}
.secret-field .input {
  padding-right: 46px;
}
.secret-field .icon-button {
  position: absolute;
  top: 50%;
  right: 4px;
  translate: 0 -50%;
}
.login .button.primary {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  font-size: 14.5px;
}
.login-status {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: 13.5px;
}
.login-status:empty {
  display: none;
}
.login-status[data-tone="danger"] {
  color: var(--danger);
}
.login-status[data-tone="warn"] {
  color: var(--warn);
}
.login .fineprint {
  margin-top: 28px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.6;
}
.login .authkit-login {
  justify-content: space-between;
  min-height: 46px;
  font-size: 14px;
  margin-top: 32px;
  padding: 0 17px;
  border-radius: 12px;
}
.authkit-login[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}
.key-recovery {
  margin-top: 24px;
}
.key-recovery > summary {
  align-content: center;
  width: fit-content;
  color: var(--text-3);
  font-size: 12.5px;
  cursor: pointer;
}
.key-recovery > summary::-webkit-details-marker {
  display: none;
}
.key-recovery > summary:hover {
  color: var(--text);
}
.key-recovery[open] > summary {
  color: var(--text-2);
}
.key-recovery form {
  margin-top: 18px;
}
.menu-heading {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Account settings share the app's neutral surfaces and stay usable as a compact mobile sheet. */
.connections-dialog {
  --dialog-width: 600px;
}
.connections-dialog .dialog-head {
  padding: 20px 24px 17px;
}
.connections-dialog .dialog-head h2 {
  flex: 1;
  font-size: 17px;
}
.connections-body {
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.connections-lede {
  font-size: 20px;
  font-weight: 610;
  letter-spacing: -0.025em;
}
.connections-description {
  margin-top: 6px;
  max-width: 460px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}
.connection-account {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-subtle);
}
.connection-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  background: var(--bg-active);
  color: var(--text-2);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 650;
}
.connection-account > div {
  min-width: 0;
  flex: 1;
}
.connection-account > div p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.connection-account-name {
  font-size: 13.5px;
  font-weight: 550;
}
.account-label {
  color: var(--text-3);
  font-size: 11.5px;
  white-space: nowrap;
}
.connections-status {
  min-height: 20px;
  margin: 20px 0 10px;
  color: var(--text-2);
  font-size: 12.5px;
}
.connections-status:empty {
  min-height: 0;
  margin-bottom: 0;
}
.connections-status[data-tone="danger"] {
  color: var(--danger);
}
.connections-status[data-tone="warn"] {
  color: var(--warn);
}
.connections-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.connections-list:empty {
  border: 0;
}
.connection-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 16px;
}
.connection-row + .connection-row {
  border-top: 1px solid var(--line);
}
.service-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-subtle);
}
.service-mark .icon {
  width: 21px;
  height: 21px;
}
.connection-details {
  flex: 1;
  min-width: 0;
}
.connection-details h3 {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 600;
}
.connection-details > .hint {
  font-size: 12px;
  line-height: 1.5;
}
.connection-state {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
  color: var(--text-3);
  font-size: 11.5px;
}
.connection-state .icon {
  width: 12px;
  height: 12px;
}
.connection-state.connected {
  color: var(--ok);
}
.connection-state.reauthorize {
  color: var(--warn);
}
.connection-actions .button {
  min-width: 84px;
  font-size: 12px;
}
.connection-actions {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.connection-scopes {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 11.5px;
}
.connection-scopes > summary {
  cursor: pointer;
}
.connection-scopes p {
  margin-top: 5px;
  overflow-wrap: anywhere;
}
.connection-setup {
  margin-top: 8px;
}
.connection-confirm,
.connection-key-form {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-subtle);
}
.connection-confirm h3,
.connection-key-form h3 {
  font-size: 14px;
  font-weight: 600;
}
.connection-confirm p,
.connection-key-form > p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
}
.connection-confirm > div,
.connection-key-form > div {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.connection-key-form .label {
  margin-top: 16px;
}
.connection-token-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  text-decoration: none;
}
.connection-token-link .icon {
  width: 12px;
  height: 12px;
}
.connections-footer {
  display: flex;
  gap: 9px;
  margin-top: 24px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.6;
}
.connections-footer > .icon {
  margin-top: 2px;
  width: 14px;
  height: 14px;
}
.connection-skeleton {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 125px;
  padding: 20px 16px;
}
.connection-skeleton + .connection-skeleton {
  border-top: 1px solid var(--line);
}
.connection-skeleton span {
  background: linear-gradient(
      90deg,
      var(--bg-active) 20%,
      var(--bg-hover) 50%,
      var(--bg-active) 80%
    )
    0 0 / 200% 100%;
  animation: shimmer 1.8s linear infinite;
  border-radius: 7px;
}
.skeleton-mark {
  width: 40px;
  height: 40px;
}
.skeleton-lines {
  width: 150px;
  height: 44px;
  margin-right: auto;
}
.skeleton-action {
  width: 84px;
  height: 32px;
}
@media (max-width: 599px) {
  .connections-dialog {
    max-height: calc(100dvh - 12px);
  }
  .connections-dialog .dialog-head {
    padding: 16px;
  }
  .connections-body {
    padding: 20px 16px max(22px, env(safe-area-inset-bottom));
  }
  .connections-lede {
    font-size: 19px;
  }
  .connection-row {
    gap: 12px;
    padding: 17px 12px;
    flex-wrap: wrap;
  }
  .connection-details {
    flex-basis: calc(100% - 56px);
  }
  .connection-actions {
    padding: 0 0 0 52px;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .connection-actions .button {
    min-height: max(36px, var(--target));
  }
  .account-label {
    display: none;
  }
}
.remember-session {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin-top: 12px;
  font-size: 14px;
  cursor: pointer;
}
.remember-session input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
}
#remember-description {
  margin-bottom: 4px;
}

/* Real commands only. Native popovers provide escape, light dismissal and focus return. */
.menu {
  position: fixed;
  inset: auto;
  width: 230px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}
.menu:popover-open {
  display: grid;
}
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
}
.menu button:hover:not(:disabled) {
  background: var(--bg-hover);
}
.menu button:disabled {
  opacity: 0.45;
}
.menu-heading {
  padding: 6px 10px 9px;
  font-size: 13px;
  font-weight: 600;
}
.menu-note {
  padding: 4px 10px 8px;
  color: var(--text-3);
  font-size: 11.5px;
}
.menu hr {
  width: 100%;
  margin: 5px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.composer-actions {
  bottom: max(110px, calc(env(safe-area-inset-bottom) + 110px));
  left: max(20px, calc((100vw - var(--column)) / 2));
}
#composer-menu {
  anchor-name: --composer-menu;
}
@supports (position-anchor: --composer-menu) {
  .composer-actions {
    position-anchor: --composer-menu;
    left: anchor(left);
    bottom: calc(anchor(top) + 8px);
  }
}
.appearance-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  font-size: 13px;
}
.appearance-control .select {
  width: auto;
  flex: 1;
  min-width: 0;
  min-height: 34px;
  padding: 5px 8px;
  font-size: 13px;
}
.dialog.search-dialog {
  --dialog-width: 560px;
}
.search-results {
  margin-top: 14px;
  min-height: 80px;
}
.dialog.rename-dialog {
  --dialog-width: 440px;
}
.rename-dialog form {
  min-height: 0;
  overflow-y: auto;
}
.dialog.keyboard-dialog {
  --dialog-width: 440px;
}
.keyboard-body .label {
  margin-top: 18px;
}
.keyboard-body .label:first-child {
  margin-top: 8px;
}
.keyboard-body .hint {
  margin-top: 8px;
}
#keyboard-status {
  margin-top: 20px;
}
@media (pointer: coarse) {
  .menu button {
    min-height: 44px;
  }
  .appearance-control .select {
    min-height: 44px;
  }
}

/* Recovery callout */
.callout {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: 12px;
  background: var(--warn-bg);
  font-size: 13.5px;
}
.callout > .icon {
  margin-top: 2px;
  color: var(--warn);
}
.callout.danger {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-bg);
}
.callout.danger > .icon {
  color: var(--danger);
}
.callout-body {
  flex: 1;
  min-width: 0;
}
.callout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.callout-actions .button.ghost:first-child,
.callout-actions [hidden] + .button.ghost {
  margin-left: -9px;
}
.callout .plain {
  max-height: 9rem;
  overflow: auto;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-raised);
  font-size: 13px;
}

/* Transcript */
.msg {
  margin-bottom: 28px;
  overflow-wrap: anywhere;
}
.plain {
  white-space: pre-wrap;
}
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: clamp(32px, 18dvh, 180px) !important;
  padding: 0 16px;
  text-align: center;
}
.empty .brand-mark {
  margin-bottom: 10px;
}
.empty strong,
.empty h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.empty p {
  max-width: 46ch;
  color: var(--text-2);
  font-size: 14.5px;
}
.msg-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.bubble {
  max-width: min(70%, 620px);
  padding: 12px 16px;
  border-radius: 20px;
  background: var(--user-bg);
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
}
.agent-report {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--bg-subtle);
}
.agent-report > summary {
  cursor: pointer;
  margin-inline: -4px;
}
.agent-report .row-title {
  overflow-wrap: anywhere;
}

.agent-report .markdown {
  margin-top: 12px;
  font-size: 14px;
}
.msg-user.queued .bubble {
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--text-2);
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  color: var(--text-3);
  font-size: 12px;
}
.msg-meta .icon {
  width: 13px;
  height: 13px;
}
.msg-user.queued .msg-meta {
  color: var(--live);
}
.msg-assistant > .markdown {
  font-size: 15px;
  line-height: 1.7;
}
.response-error {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  white-space: pre-wrap;
}
.response-error:has(.disclosure) {
  white-space: normal;
}
.error-summary {
  margin: 0;
}
/* Compact inline disclosure for secondary detail (raw errors, earlier text). */
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  min-height: 28px;
  margin: 2px 0 -4px -2px;
  color: var(--text-2);
  font-size: 12.5px;
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker {
  display: none;
}
.disclosure > summary .icon {
  width: 14px;
  height: 14px;
  transition: rotate 0.15s;
}
.disclosure[open] > summary .icon {
  rotate: 90deg;
}
.error-raw {
  max-height: 240px;
  overflow: auto;
  margin: 8px 0 4px;
  color: var(--text-2);
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-actions {
  display: flex;
  gap: 2px;
  margin: 6px 0 0 -6px;
}
.output-limit {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
}

/* Activity rows: tools and thinking-only steps share one dense, scannable rhythm. */
.msg.activity {
  margin-bottom: 0;
}
.msg.activity.run-end {
  margin-bottom: 18px;
}
.row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  margin: 0 -8px;
  padding: 4px 8px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.row::-webkit-details-marker {
  display: none;
}
.row:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.row > .icon {
  color: var(--text-3);
}
.row-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.row .chev {
  color: var(--text-3);
  opacity: 0.65;
  transition:
    opacity 0.12s,
    rotate 0.15s;
}
.row:hover .chev,
.row:focus-visible .chev,
details[open] > .row .chev {
  opacity: 1;
}
details[open] > .row .chev {
  rotate: 90deg;
}
@media (pointer: coarse) {
  .row,
  .disclosure > summary {
    min-height: 44px;
  }
  .row .chev {
    opacity: 1;
  }
}
.tool-name {
  margin-right: 7px;
  color: var(--text-3);
  font-size: 12px;
}
.tool-args {
  color: var(--text);
  font: 12.5px/1.4 var(--mono);
}
.msg-tool.failed .row > .icon,
.msg-tool.failed .row-meta,
.msg-tool.failed .tool-args {
  color: var(--danger);
}
.msg-tool.uncertain .row > .icon,
.msg-tool.uncertain .row-meta {
  color: var(--warn);
}
.msg-tool.running .row-meta {
  color: var(--live);
}
.tool-panel {
  margin: 2px 0 10px 25px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-subtle);
}
.panel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 3px 3px 3px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12px;
}
.panel-bar > span {
  flex: 1;
  min-width: 0;
}
.tool-command {
  padding: 10px 12px 0;
  color: var(--text);
  font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
}
.tool-command.shell-command::before {
  content: "$ ";
  color: var(--text-3);
}
.tool-output {
  max-height: 440px;
  overflow: auto;
  padding: 10px 12px 12px;
  color: var(--text-2);
  font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-tool.failed .tool-output {
  color: var(--danger);
}
.thought > .row {
  width: fit-content;
  max-width: calc(100% + 16px);
}
.thought > .row .thought-label {
  flex: none;
  font-weight: 550;
}
.thought[open] > .row .thought-preview {
  display: none;
}
.thought-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thinking .thought-label {
  background: linear-gradient(90deg, var(--text-3) 20%, var(--text) 50%, var(--text-3) 80%) 0 0 /
    200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.8s linear infinite;
}
.thought-body {
  max-height: 320px;
  overflow: auto;
  margin: 6px 0 12px 7px;
  padding: 4px 12px 4px 17px;
  border-left: 2px solid var(--line);
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.msg-assistant:not(.activity) > .thought {
  margin-bottom: 6px;
}
.activity-head {
  margin: 12px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.activity-head .row {
  width: calc(100% + 16px);
  border: 0;
  background: transparent;
  font-weight: 550;
  color: var(--text-2);
  text-align: left;
}
.activity-head .row-meta {
  margin-right: 25px;
}
.activity-head .spinner {
  color: var(--live);
}
.activity-head .failed-count {
  color: var(--danger);
}
.activity-head .uncertain-count {
  color: var(--warn);
}

/* Markdown */
.markdown > :first-child {
  margin-top: 0;
}
.markdown > :last-child {
  margin-bottom: 0;
}
.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown .code-block,
.markdown .table-scroll {
  margin: 12px 0;
}
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 24px 0 8px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.markdown h1 {
  font-size: 20px;
}
.markdown h2 {
  font-size: 17.5px;
}
.markdown h3 {
  font-size: 15.5px;
}
.markdown ul,
.markdown ol {
  padding-left: 22px;
}
.markdown li + li {
  margin-top: 4px;
}
.markdown blockquote {
  padding-left: 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--text-2);
}
.markdown :not(pre) > code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-active);
  font-size: 0.86em;
}
.markdown hr {
  margin: 22px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.code-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-subtle);
}
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 3px 3px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12px;
}
.code-toolbar span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.code-toolbar .icon-button {
  width: var(--target);
  height: var(--target);
}
@media (pointer: coarse) {
  .code-toolbar .icon-button {
    width: 44px;
    height: 44px;
  }
}
.markdown pre {
  max-height: 520px;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}
.table-scroll {
  max-width: 100%;
  overflow: auto;
}
.markdown table {
  border-collapse: collapse;
  font-size: 13.5px;
  overflow-wrap: normal;
}
.markdown table code {
  white-space: nowrap;
  overflow-wrap: normal;
}
.markdown th,
.markdown td {
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.markdown th {
  border-bottom-color: var(--line-strong);
  font-weight: 600;
}

/* Side panel (Files) */
.side-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-subtle);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  height: 48px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  flex: 1;
  font-size: 14px;
  font-weight: 620;
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 8px 24px;
}
.panel-section {
  padding: 14px 8px;
  border-top: 1px solid var(--line);
}
.panel-section:first-child {
  border-top: 0;
  padding-top: 6px;
}
.panel-section h3 {
  margin-bottom: 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0 -4px 6px;
  font: 12.5px/1.3 var(--mono);
}
.crumbs button {
  min-height: 26px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--accent);
  font: inherit;
}
.crumbs button:hover {
  background: var(--bg-hover);
}
.crumbs [aria-current] {
  padding: 0 5px;
  color: var(--text);
  font-weight: 600;
}
.crumbs .sep {
  color: var(--text-3);
}
.file-list {
  margin: 0 -4px;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 2px 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}
button.file-row:hover,
div.file-row:hover {
  background: var(--bg-hover);
}
.file-row > .icon {
  color: var(--text-3);
}
.file-row.directory > .icon {
  color: var(--accent);
}
.file-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-row .size {
  flex: none;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.file-row.directory {
  padding-right: 10px;
}
@media (pointer: coarse) {
  .file-row {
    min-height: 44px;
  }
}
.panel-status {
  margin: 4px 4px 8px;
  color: var(--text-3);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.panel-status:empty {
  display: none;
}
.download-ready {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-raised);
  font-size: 13px;
}
.download-ready a {
  flex: 1;
  min-width: 0;
  font-weight: 550;
}
.workspace-state {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
}
.workspace-state .dot {
  margin-top: 6px;
}
.workspace-state p + p {
  margin-top: 2px;
}
.process-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.process-row:first-child {
  border-top: 0;
}
.process-row .process-command {
  flex: 1;
  min-width: 0;
  max-height: 4.5em;
  overflow: auto;
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.process-row .hint {
  flex: none;
}
.panel-section details > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
  list-style: none;
  cursor: pointer;
}
.panel-section details > summary::-webkit-details-marker {
  display: none;
}
.panel-section details[open] > summary .chev {
  rotate: 90deg;
}
.panel-section details p {
  margin: 6px 0;
}
@media (pointer: coarse) {
  .crumbs button,
  .panel-section details > summary {
    min-height: 44px;
  }
}
.stack {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

/* Review */
.review-page {
  min-height: 100dvh;
}
.review-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 32px 22px;
}
.review-repo {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font: 13px/1.4 var(--mono);
}
.review-repo a {
  color: inherit;
  text-decoration: none;
}
.review-repo a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.review-header h1 {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.review-links {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.review-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  color: var(--text-2);
  font-size: 13px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px 0 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}
.pill[data-tone="ok"] {
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}
.pill[data-tone="danger"] {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: var(--danger-bg);
  color: var(--danger);
}
.pill[data-tone="warn"] {
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  background: var(--warn-bg);
  color: var(--warn);
}
.review-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "outcome side" "main side";
  gap: 0 48px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px 32px 96px;
}
.review-outcome {
  grid-area: outcome;
  min-width: 0;
}
.review-outcome > :not([hidden]) {
  margin-bottom: 24px;
}
.review-main {
  grid-area: main;
  min-width: 0;
}
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-size: 14px;
  font-weight: 620;
}
.section-head .hint {
  flex: 1;
}
.review-main .msg-user {
  align-items: stretch;
  margin-bottom: 6px;
}
.review-side {
  grid-area: side;
  position: sticky;
  top: 68px;
  display: grid;
  gap: 24px;
  max-height: calc(100dvh - 84px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 4px 24px 2px;
  font-size: 13.5px;
}
.side-block h2 {
  margin-bottom: 10px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.review-summary .markdown {
  font-size: 15px;
  line-height: 1.65;
}
.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 14px;
  font-size: 13px;
}
.facts dt {
  color: var(--text-3);
}
.facts dd {
  min-width: 0;
  overflow-wrap: anywhere;
}
.facts code {
  font-size: 12px;
}
.checks > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  list-style: none;
  cursor: pointer;
}
.checks > summary::-webkit-details-marker {
  display: none;
}
.checks > summary h2 {
  flex: 1;
  margin: 0;
}
.checks[open] > summary .chev {
  rotate: 90deg;
}
@media (pointer: coarse) {
  .checks > summary {
    min-height: 44px;
  }
}
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.check-row:first-child {
  border-top: 0;
}
.check-row > .icon {
  margin-top: 1px;
  width: 15px;
  height: 15px;
  color: var(--ok);
}
.check-row.failed > .icon {
  color: var(--danger);
}
.check-row.running > .icon {
  color: var(--live);
}
.check-row code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.5;
}
.check-row .hint {
  flex: none;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.limits {
  margin: 0;
  padding-left: 18px;
}
.limits li + li {
  margin-top: 6px;
}
.live-tail {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  color: var(--text-2);
  font-size: 13px;
}
.review-jump {
  position: fixed;
  z-index: 15;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: calc(50% - 170px);
  translate: -50% 0;
  display: inline-flex;
  gap: 6px;
  border-radius: 99px;
  box-shadow: var(--shadow-pop);
}

/* Model dialog */
.dialog {
  width: min(var(--dialog-width, 600px), calc(100% - 32px));
  max-height: min(760px, calc(100dvh - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.dialog[open] {
  display: flex;
  flex-direction: column;
}
.dialog::backdrop {
  background: rgb(10 15 12 / 0.4);
  backdrop-filter: blur(2px);
}
.dialog-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 60px;
  padding: 12px 16px 12px 24px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  flex: 1;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.dialog-pane {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 24px;
}
.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
}
.dialog-foot .hint {
  flex: 1 1 200px;
}
.dialog-foot .connect {
  margin: 0 auto 0 -10px;
  padding-inline: 10px;
}
@media (min-width: 641px) {
  .dialog-foot .connect::after {
    display: none;
  }
}
.search-field {
  position: relative;
}
.search-field > .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  translate: 0 -50%;
  color: var(--text-3);
  pointer-events: none;
}
.search-field .input {
  padding-left: 36px;
}
.dialog-status {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.dialog-status:empty {
  display: none;
}
#model-dialog {
  height: min(760px, calc(100dvh - 24px));
}
#model-status,
#reviewer-status {
  flex: none;
  margin: 0;
  padding: 16px 24px 0;
}
#reviewer-model {
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
}
.model-list {
  margin: 12px -8px 0;
}
.model-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.model-group + .model-group {
  margin-top: 10px;
}
.model-group legend {
  display: flex;
  gap: 6px;
  padding: 6px 8px 4px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.model-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.model-row:hover {
  background: var(--bg-hover);
}
.model-row:has(input:checked) {
  background: var(--accent-soft);
}
.model-row:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.model-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.model-row .model-text {
  flex: 1;
  min-width: 0;
}
.model-row .model-title {
  display: block;
  font-size: 14px;
  font-weight: 550;
}
.model-row small {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.model-row .check {
  color: var(--accent);
  opacity: 0;
}
.model-row:has(input:checked) .check {
  opacity: 1;
}
.detail-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-subtle);
}
.detail-card .hint {
  margin-top: 6px;
}
.model-choice {
  margin: 0 0 16px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.selected-model {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.selected-model strong {
  font-size: 14px;
  font-weight: 600;
}
.thinking-control {
  min-width: 0;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}
.thinking-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.thinking-label label {
  color: var(--text-2);
}
.thinking-label output {
  font-weight: 600;
}
#thinking-level {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 32px;
  margin: 3px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
#thinking-level::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) var(--thinking-progress, 0%),
    var(--line-strong) var(--thinking-progress, 0%)
  );
}
#thinking-level::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7.5px;
  border: 2px solid var(--bg-raised);
  border-radius: 50%;
  background: var(--accent);
}
#thinking-level::-moz-range-track {
  height: 3px;
  border-radius: 99px;
  background: var(--line-strong);
}
#thinking-level::-moz-range-progress {
  height: 3px;
  border-radius: 99px;
  background: var(--accent);
}
#thinking-level::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--bg-raised);
  border-radius: 50%;
  background: var(--accent);
}
#thinking-level:focus-visible {
  outline: none;
}
#thinking-level:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}
#thinking-level:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}
.thinking-control:disabled #thinking-level {
  cursor: default;
  opacity: 0.5;
}
.thinking-ticks {
  position: relative;
  height: 18px;
  margin-inline: 9px;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.2;
}
.thinking-ticks span {
  position: absolute;
  left: var(--tick-position);
  translate: -50% 0;
  white-space: nowrap;
}
.thinking-ticks span:first-child {
  translate: 0 0;
}
.thinking-ticks span:last-child {
  translate: -100% 0;
}
.fast-control {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.fast-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  font-size: 13px;
  cursor: pointer;
}
.fast-label input {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: var(--bg-active);
  cursor: pointer;
}
.fast-label input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: translate 0.12s;
}
.fast-label input:checked {
  border-color: var(--accent);
  background: var(--accent);
}
.fast-label input:checked::before {
  translate: 14px 0;
  background: var(--bg);
}
.fast-label input:disabled {
  opacity: 0.45;
  cursor: default;
}
.fast-badge {
  flex: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 550;
}
.model-info {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 12px;
}
.model-info > summary {
  align-content: center;
  width: fit-content;
  cursor: pointer;
}
@media (pointer: coarse) {
  #thinking-level,
  .fast-label {
    min-height: 44px;
  }
}
.provider-card {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.provider-card:first-child {
  border-top: 0;
}
.provider-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 620;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--bg-active);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
}
.badge.ok {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}
.badge.warn {
  background: color-mix(in srgb, var(--warn) 16%, transparent);
  color: var(--warn);
}
.provider-card p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12.5px;
}
.method {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 10px;
}
.method > div {
  flex: 1 1 240px;
  min-width: 0;
}
.method strong {
  font-size: 13px;
  font-weight: 600;
}
.provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.auth-flow {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-subtle);
}
.auth-flow h3 {
  font-size: 14.5px;
  font-weight: 620;
}
.auth-flow p,
#auth-events p {
  margin-top: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.auth-flow form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.device-code {
  display: block;
  margin: 24px 0 12px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-raised);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-align: center;
  user-select: all;
}

/* Responsive */
@media (max-width: 1000px) {
  .review-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "outcome" "side" "main";
    padding: 0 20px 96px;
  }
  .review-side {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 28px;
    padding: 0;
    gap: 4px;
  }
  .review-side .side-block {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 14px;
  }
  .review-side .side-block[open] {
    padding-bottom: 12px;
  }
  .review-header {
    padding: 22px 20px 18px;
  }
  .review-jump {
    left: 50%;
  }
}
@media (max-width: 640px) {
  :root {
    --target: 44px;
  }
  .topbar {
    padding-left: 12px;
    padding-right: 6px;
  }
  .topbar .brand-name {
    display: none;
  }
  .menu {
    max-width: calc(100vw - 24px);
  }
  .bubble {
    max-width: 92%;
  }
  .tool-panel {
    margin-left: 0;
  }
  .row-meta .lines {
    display: none;
  }
  .review-header {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 16px 14px;
  }
  .review-header h1 {
    font-size: 19px;
  }
  .review-links {
    order: 3;
  }
  .review-body {
    padding: 0 16px 96px;
  }
  .dialog,
  .dialog.search-dialog,
  .dialog.rename-dialog,
  .dialog.keyboard-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    border-width: 1px 0 0;
  }
  .dialog-head {
    padding-inline: 16px 12px;
  }
  .dialog-body {
    padding: 16px 16px max(20px, env(safe-area-inset-bottom));
  }
  #model-dialog {
    height: calc(100dvh - 12px);
  }
  #model-status {
    padding-inline: 16px;
  }
  .dialog-foot {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  }
  .dialog-foot .connect .button-label {
    display: none;
  }
  .dialog-foot .connect {
    width: var(--target);
    padding: 0;
    margin-left: -6px;
  }
  .input,
  .select {
    min-height: 44px;
    font-size: 16px;
  }
}

/* Personal model preferences stay secondary to choosing a model. */
.context-control {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.text-button {
  border: 0;
  min-height: var(--target);
  padding: 4px 8px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
}
.text-button:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.context-input {
  position: relative;
  margin: 8px 0 6px;
}
.context-input .input {
  padding-right: 75px;
  font-variant-numeric: tabular-nums;
}
.context-input span {
  position: absolute;
  top: 50%;
  right: 32px;
  translate: 0 -50%;
  color: var(--text-3);
  font-size: 12px;
  pointer-events: none;
}
.model-visibility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
  font-size: 12px;
  color: var(--text-2);
}
.model-visibility label,
.hidden-files-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--target);
  cursor: pointer;
}
.model-visibility input,
.hidden-files-control input {
  margin: 0;
  accent-color: var(--primary);
}
.hidden-files-control {
  margin-bottom: 12px;
  color: var(--text-2);
  font-size: 12px;
}
.model-row-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}
.model-row-wrap .model-row {
  flex: 1;
  min-width: 0;
}
.model-row-wrap .visibility-button {
  color: var(--text-3);
}
.model-row-wrap[data-hidden="true"] .model-text {
  opacity: 0.55;
}

@keyframes tooltip-appear {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: no-preference) {
  #control-tooltip:popover-open {
    animation: tooltip-appear 120ms ease-out;
  }
}

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