:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101419;
  --bg-elev: #151b22;
  --bg-elev-2: #111820;
  --bg-soft: #1d252d;
  --panel: #151b22;
  --line: #33404d;
  --line-strong: #4b5a67;
  --fg: #edf2f7;
  --fg-dim: #9aa8b4;
  --fg-muted: #6f7d88;
  --blue: #71a7ff;
  --green: #8bd17c;
  --amber: #e5b567;
  --red: #ff7f8f;
  --ink: #0c1116;
  --nav-h: 70px;
  --status-tabs-h: 58px;
  --app-topbar-h: 72px;
  --app-shell-top: calc(var(--app-topbar-h) + env(safe-area-inset-top));
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f8fafc;
  --bg-soft: #eceef2;
  --panel: #ffffff;
  --line: rgba(15,23,42,0.10);
  --line-strong: rgba(15,23,42,0.18);
  --fg: #0f172a;
  --fg-dim: #3d4b5e;
  --fg-muted: #52606f;
  --blue: #3b66e0;
  --green: #15803d;
  --amber: #92400e;
  --red: #b91c1c;
  --ink: #ffffff;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 100%;
  background: var(--bg);
  overflow-x: clip;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible,
[contenteditable]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

html.detail-sheet-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.detail-sheet-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.detail-sheet-open .app-main,
body.detail-sheet-open .bottom-nav,
body.detail-sheet-open .status-summary,
body.detail-sheet-open .app-topbar {
  pointer-events: none;
  user-select: none;
}

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

.file-picker-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mobile-app {
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.app-topbar,
.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 96%, transparent);
  backdrop-filter: blur(12px);
}

.app-topbar {
  position: fixed;
  left: 0;
  right: 0;
  min-height: var(--app-shell-top);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}

.app-reload-banner {
  position: fixed;
  top: var(--app-shell-top);
  left: 10px;
  right: 10px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--amber) 14%, var(--bg-elev));
  color: var(--fg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.28);
}

.app-reload-banner[hidden] {
  display: none;
}

.app-reload-banner div {
  flex: 1 1 auto;
  min-width: 0;
}

.app-reload-banner strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.app-reload-banner span {
  display: block;
  margin-top: 2px;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.3;
}

.app-reload-banner button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.app-kicker {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 2px;
  font-size: 24px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

h3 {
  font-size: 15px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg);
  font-size: 18px;
}

.detail-back-btn {
  grid-auto-flow: column;
  gap: 6px;
  width: auto;
  min-width: 52px;
  padding: 0 12px;
  border-color: color-mix(in srgb, var(--blue) 34%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 12%, var(--bg-soft));
  color: var(--blue);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 7%, transparent);
}

.detail-back-glyph {
  font-size: 20px;
  line-height: 1;
}

.detail-back-label {
  display: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1;
}

.connection-chip,
.state-chip,
.scope-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.connection-chip {
  min-height: 40px;
  padding-inline: 12px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.connection-chip:active {
  transform: translateY(1px);
}

.connection-chip.live,
.state-chip.running {
  border-color: rgba(113, 167, 255, 0.45);
  color: var(--blue);
}

.state-chip.resuming {
  border-color: rgba(224, 175, 104, 0.48);
  color: var(--yellow);
}

.connection-chip.secure,
.state-chip.fresh {
  border-color: rgba(139, 209, 124, 0.45);
  color: var(--green);
}

.connection-chip.offline,
.state-chip.waiting,
.state-chip.needs_user {
  border-color: rgba(255, 127, 143, 0.5);
  color: var(--red);
}

.app-main {
  position: fixed;
  top: var(--app-shell-top);
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  overflow-x: clip;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-view {
  display: none;
  min-width: 0;
  max-width: 100%;
  padding: 14px 0 18px;
}

.mobile-view.active {
  display: block;
}

.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 10px;
}

.view-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.section-block {
  padding: 14px 16px 4px;
  scroll-margin-top: 16px;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.section-block:focus {
  outline: none;
}

.section-block.section-block-target {
  background: color-mix(in srgb, var(--blue) 9%, transparent);
  box-shadow: inset 3px 0 0 var(--blue);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-rows {
  display: grid;
  min-width: 0;
  margin: 8px -16px -4px;
}

.section-rows > .empty-state {
  border-top: 1px solid var(--line);
}

.status-summary {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  z-index: 19;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  min-height: var(--status-tabs-h);
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: rgba(16, 20, 25, 0.96);
  backdrop-filter: blur(12px);
}

body.mobile-app:not([data-mobile-tab="status"]) .status-summary {
  display: none;
}

#view-status .view-content {
  padding-bottom: calc(var(--status-tabs-h) + 16px);
}

.summary-tile {
  appearance: none;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-dim);
  cursor: pointer;
  text-align: center;
  touch-action: manipulation;
}

.summary-tile:active {
  background: color-mix(in srgb, var(--blue) 10%, transparent);
}

.summary-tile strong {
  display: block;
  color: var(--fg);
  font-size: 18px;
  line-height: 1;
}

.summary-tile span {
  display: block;
  margin-top: 0;
  overflow: hidden;
  max-width: 100%;
  color: currentColor;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-tile.urgent {
  border-color: rgba(255, 127, 143, 0.45);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
}

.summary-tile.active {
  border-color: rgba(113, 167, 255, 0.4);
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  color: var(--blue);
}

.worktree-summary {
  margin: 4px 0 8px;
  padding: 10px 16px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
}

.worktree-summary-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.worktree-summary-head > span:first-child {
  min-width: 0;
}

.worktree-summary-kicker {
  display: block;
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.worktree-summary-head strong {
  display: block;
  margin-top: 2px;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.15;
}

.worktree-summary-stats {
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.worktree-summary-list {
  display: grid;
}

.worktree-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 6px 0;
  border-top: 1px solid rgba(120, 135, 180, 0.16);
}

.worktree-summary-row:first-child {
  border-top: 0;
}

.worktree-summary-open {
  appearance: none;
  display: grid;
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 7px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.worktree-summary-open:active {
  background: color-mix(in srgb, var(--blue) 8%, transparent);
}

.worktree-summary-open:focus-visible,
.session-diff-chip-action:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.worktree-summary-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.worktree-summary-title {
  min-width: 0;
  color: var(--fg);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worktree-summary-row.main .worktree-summary-title {
  color: #f6c177;
}

.worktree-summary-meta {
  min-width: 0;
  color: var(--fg-dim);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worktree-summary-row .session-diff-tags {
  justify-content: flex-end;
  margin-top: 0;
}

.worktree-summary-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 9%, transparent);
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.worktree-summary-toggle::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 150ms ease, margin 150ms ease;
}

.worktree-summary-toggle[aria-expanded="true"]::before {
  margin-top: 3px;
  transform: rotate(225deg);
}

.worktree-summary-toggle:active {
  background: color-mix(in srgb, var(--blue) 16%, transparent);
}

.worktree-summary-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.home-search {
  display: grid;
  gap: 6px;
  padding: 6px 16px 10px;
}

.home-search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 38px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
}

.home-search-icon {
  justify-self: end;
  color: var(--fg-muted);
  font-size: 15px;
  font-weight: 900;
}

.home-search-box input {
  min-width: 0;
  height: 46px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  outline: none;
}

.home-search-box input::placeholder {
  color: var(--fg-muted);
}

.home-search-box:focus-within {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}

.home-search-clear {
  justify-self: center;
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  min-height: 44px;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.home-search.has-query .home-search-clear {
  opacity: 1;
  pointer-events: auto;
}

.home-search-clear:active {
  background: var(--bg-soft);
  color: var(--fg);
}

.home-search-status {
  min-height: 15px;
  padding: 0 2px;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.status-focus-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: calc(100vw - 32px);
  margin: 8px 16px 10px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 13%, transparent), transparent 58%),
    color-mix(in srgb, var(--bg-elev) 92%, var(--bg));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 7%, transparent);
}

.status-focus-panel.needs_user,
.status-focus-panel.waiting,
.status-focus-panel.waiting_input {
  border-color: color-mix(in srgb, var(--red) 40%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--red) 12%, transparent), transparent 58%),
    color-mix(in srgb, var(--bg-elev) 92%, var(--bg));
}

.status-focus-panel.ready_review {
  border-color: color-mix(in srgb, var(--green) 36%, var(--line));
}

.status-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.status-focus-head > span:first-child {
  min-width: 0;
}

.status-focus-head .state-chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-focus-kicker {
  display: block;
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.status-focus-head h2 {
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  color: var(--fg);
  font-size: 18px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-focus-meta,
.status-focus-goal {
  min-width: 0;
  max-width: 100%;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.status-focus-goal {
  color: var(--fg);
}

.status-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.status-focus-actions .row-action {
  min-width: 118px;
}

.status-cockpit {
  display: grid;
  gap: 10px;
}

.status-cockpit-column {
  min-width: 0;
}

.session-row,
.result-row,
.device-row,
.walle-row,
.more-row {
  position: relative;
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 12px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
  min-height: 72px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  text-align: left;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.session-row:active,
.result-row:active,
.more-row:active {
  background: var(--bg-soft);
}

.session-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.session-row.dismissed {
  background: color-mix(in srgb, var(--fg-muted) 5%, var(--bg));
}

.rail {
  width: 5px;
  height: 100%;
  min-height: 46px;
  border-radius: 999px;
  background: var(--fg-muted);
}

.rail.needs_user,
.rail.waiting,
.rail.waiting_input {
  background: var(--red);
}

.rail.running {
  background: var(--blue);
}

.rail.resuming {
  background: var(--yellow);
}

.rail.ready_review {
  background: var(--green);
}

.rail.continue_later,
.rail.idle,
.rail.exited {
  background: var(--fg-muted);
}

.session-main,
.result-main {
  min-width: 0;
}

.session-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.session-title,
.result-title {
  display: block;
  min-width: 0;
  color: var(--fg);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.session-title-line .session-title {
  flex: 1 1 128px;
}

.mobile-provider-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 118px;
  min-height: 20px;
  padding: 2px 8px;
  border: 1px solid rgba(120, 135, 180, 0.36);
  border-radius: 999px;
  background: rgba(120, 135, 180, 0.12);
  color: var(--fg-dim);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-provider-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  opacity: 0.88;
}

.mobile-provider-anthropic {
  color: #ff9e64;
  border-color: rgba(255, 158, 100, 0.34);
  background: rgba(255, 158, 100, 0.08);
}

.mobile-provider-openai {
  color: #74d7c7;
  border-color: rgba(116, 215, 199, 0.30);
  background: rgba(116, 215, 199, 0.10);
}

.mobile-provider-walle {
  color: #8fb4ff;
  border-color: rgba(143, 180, 255, 0.34);
  background: rgba(143, 180, 255, 0.11);
}

.mobile-provider-cursor {
  color: #d6dcff;
  border-color: rgba(214, 220, 255, 0.34);
  background: rgba(214, 220, 255, 0.10);
}

.mobile-provider-google {
  color: #8ab4f8;
  border-color: rgba(138, 180, 248, 0.34);
  background: rgba(138, 180, 248, 0.10);
}

.mobile-provider-deepseek {
  color: #7aa2ff;
  border-color: rgba(77, 107, 254, 0.38);
  background: rgba(77, 107, 254, 0.12);
}

.mobile-provider-moonshot {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.34);
  background: rgba(167, 139, 250, 0.11);
}

.mobile-provider-ollama,
.mobile-provider-mlx {
  color: #a6e3a1;
  border-color: rgba(166, 227, 161, 0.28);
  background: rgba(166, 227, 161, 0.10);
}

.mobile-provider-openrouter,
.mobile-provider-xai {
  color: #c0caf5;
  border-color: rgba(192, 202, 245, 0.24);
  background: rgba(192, 202, 245, 0.09);
}

.session-meta,
.result-meta,
.device-meta {
  margin-top: 4px;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.session-diff-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 7px;
}

.session-runtime-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 7px;
}

.session-runtime-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(103, 232, 249, 0.30);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(96, 165, 250, 0.10));
  color: #99f6e4;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.session-diff-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(120, 135, 180, 0.34);
  border-radius: 6px;
  background: rgba(120, 135, 180, 0.10);
  color: var(--fg-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-diff-chip-action {
  cursor: pointer;
  touch-action: manipulation;
}

.session-diff-chip::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
  flex: 0 0 auto;
  opacity: 0.9;
}

.session-diff-chip.files {
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(245, 158, 11, 0.12);
  color: #f6c177;
}

.session-diff-chip.commits {
  border-color: rgba(116, 215, 199, 0.32);
  background: rgba(116, 215, 199, 0.10);
  color: #74d7c7;
}

.session-diff-chip-action {
  appearance: none;
  cursor: pointer;
  touch-action: manipulation;
}

.worktree-summary-row .session-diff-tags {
  justify-content: flex-end;
  margin-top: 0;
}

.worktree-summary-row .session-diff-chip-action {
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 9px;
}

.worktree-summary-row .session-diff-chip-action:active {
  transform: translateY(1px);
  filter: brightness(1.08);
}

.session-goal,
.result-preview {
  margin-top: 7px;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.session-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  margin-top: 8px;
  overflow: hidden;
}

.home-search-match {
  display: block;
  margin-top: 6px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.home-search-match-label {
  display: inline-block;
  margin-right: 6px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.evidence-chip {
  min-width: 0;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-dim);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .worktree-summary-row {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
  }

  .worktree-summary-row .session-diff-tags {
    justify-content: flex-start;
  }

  .session-diff-tags {
    gap: 5px;
  }

  .session-diff-chip {
    min-height: 21px;
    padding-inline: 6px;
    font-size: 10.5px;
  }
}

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.row-action,
.primary-btn,
.secondary-btn,
.send-btn,
.primary-fab {
  border-radius: 8px;
  font-weight: 800;
}

.row-action,
.primary-btn,
.send-btn,
.primary-fab {
  background: var(--fg);
  color: var(--ink);
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 72px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.row-action:disabled {
  opacity: 0.45;
}

.row-action.warn {
  background: var(--red);
  color: var(--ink);
}

.row-action.secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-dim);
}

.row-action.secondary:active {
  background: var(--bg-soft);
  color: var(--fg);
}

.row-action.compact {
  min-height: 36px;
  min-width: 72px;
  padding-inline: 10px;
  font-size: 12px;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--fg);
}

.primary-fab {
  width: 44px;
  min-width: 44px;
  font-size: 24px;
}

.empty-state,
.error-state {
  padding: 28px 16px;
  color: var(--fg-dim);
  line-height: 1.45;
}

.error-state {
  color: var(--red);
}

.mobile-auth-recovery-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 110, 130, 0.38);
  border-radius: 8px;
  background: rgba(255, 110, 130, 0.08);
  color: var(--fg);
}

.mobile-auth-recovery-card strong {
  color: var(--red);
}

.mobile-auth-recovery-card .primary-action {
  margin-top: 2px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(16, 20, 25, 0.97);
  backdrop-filter: blur(12px);
}

html[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(15,23,42,0.06);
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .status-summary {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(15,23,42,0.06);
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .nav-item.active {
  color: var(--blue);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  background: transparent;
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.nav-item span {
  font-size: 16px;
  line-height: 1;
}

.nav-item.active {
  color: var(--fg);
}

.detail-view {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  height: calc(100vh - var(--mobile-keyboard-offset, 0px));
  min-height: calc(100vh - var(--mobile-keyboard-offset, 0px));
  height: calc(100dvh - var(--mobile-keyboard-offset, 0px));
  min-height: calc(100dvh - var(--mobile-keyboard-offset, 0px));
  padding: env(safe-area-inset-top) 0 0;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--bg);
}

.detail-view.active {
  display: flex;
  flex-direction: column;
}

.detail-title-block {
  min-width: 0;
  flex: 1;
}

.detail-title-block h2,
.detail-title-block p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-title-block h2 {
  cursor: text;
  touch-action: manipulation;
}

.detail-title-block h2.editing,
.detail-title-block h2.saving {
  overflow: visible;
}

.detail-title-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--blue) 58%, var(--line));
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  font: inherit;
  font-weight: inherit;
  line-height: 1.15;
  padding: 4px 8px;
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}

.detail-title-input:disabled {
  opacity: 0.68;
}

.detail-title-block p {
  margin-top: 3px;
  color: var(--fg-dim);
  font-size: 12px;
}

.detail-topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.timeline-mode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  touch-action: manipulation;
}

.timeline-mode-toggle-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 36%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 10%, var(--bg-soft));
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 8%, transparent);
}

.timeline-mode-toggle[data-mode="normal"] .timeline-mode-toggle-label {
  border-color: var(--line);
  background: var(--bg-soft);
  color: var(--fg-dim);
}

.timeline-mode-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.detail-alert {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 127, 143, 0.08);
}

.detail-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-alert h3 {
  color: var(--red);
}

.detail-alert-dismiss {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 127, 143, 0.42);
  border-radius: 999px;
  background: rgba(255, 127, 143, 0.08);
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  touch-action: manipulation;
}

.detail-alert-dismiss:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.detail-alert p {
  margin-top: 4px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.35;
}

.detail-alert .alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.detail-alert .approval-actions .control-btn {
  min-height: 42px;
}

.detail-alert .approval-primary {
  border-color: color-mix(in srgb, var(--blue) 68%, var(--line));
  background: color-mix(in srgb, var(--blue) 20%, var(--bg-soft));
  color: var(--blue);
}

.detail-alert #detail-control-status {
  margin-top: 8px;
  min-height: 16px;
  font-size: 12px;
  line-height: 1.35;
}

.detail-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}

.detail-controls[hidden] {
  display: none;
}

.control-copy {
  min-width: 0;
}

.control-copy strong,
.control-copy span {
  display: block;
}

.control-copy strong {
  color: var(--fg);
  font-size: 13px;
  line-height: 1.2;
}

.control-copy span {
  margin-top: 3px;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.35;
}

.control-status.ok {
  color: var(--green);
}

.control-status.error {
  color: var(--red);
}

.control-btn {
  min-width: 104px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg);
  font-weight: 800;
}

.control-btn.primary {
  border-color: color-mix(in srgb, var(--blue) 72%, var(--line));
  background: var(--blue);
  color: #08101f;
}

.control-btn.warn {
  border-color: rgba(229, 181, 103, 0.55);
  color: var(--amber);
}

.control-btn:disabled {
  opacity: 0.55;
}

.detail-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  padding: 12px 12px 32px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#detail-composer[hidden],
#detail-status[hidden],
#detail-timeline-toggle[hidden] {
  display: none !important;
}

.mobile-doc-state {
  margin: 10px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1.45;
}

.mobile-doc-state.error {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  color: var(--red);
}

.mobile-doc-viewer {
  display: grid;
  gap: 10px;
}

.mobile-doc-heading {
  position: sticky;
  top: -12px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.2;
}

.mobile-doc-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-doc-heading span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--fg-dim);
  font-weight: 800;
}

.mobile-doc-block {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 12px 12px 0;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 10px;
  background: var(--bg-elev);
}

.mobile-doc-block.active {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  border-left-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, var(--bg-elev));
}

.mobile-doc-lines {
  padding-top: 2px;
  color: var(--fg-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  text-align: right;
  user-select: none;
}

.mobile-doc-markdown {
  min-width: 0;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.mobile-doc-markdown > :first-child { margin-top: 0; }
.mobile-doc-markdown > :last-child { margin-bottom: 0; }

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

.mobile-doc-markdown h1,
.mobile-doc-markdown h2,
.mobile-doc-markdown h3,
.mobile-doc-markdown h4 {
  margin: 14px 0 8px;
  color: var(--fg);
  line-height: 1.25;
}

.mobile-doc-markdown h1 { font-size: 20px; }
.mobile-doc-markdown h2 { font-size: 18px; }
.mobile-doc-markdown h3 { font-size: 16px; }
.mobile-doc-markdown h4 { font-size: 14px; color: var(--fg-dim); }

.mobile-doc-markdown ul,
.mobile-doc-markdown ol {
  padding-left: 20px;
}

.mobile-doc-markdown li + li {
  margin-top: 4px;
}

.mobile-doc-markdown pre {
  max-width: 100%;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.mobile-doc-markdown code {
  padding: 1px 4px;
  border-radius: 5px;
  background: var(--bg-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.mobile-doc-markdown pre code {
  padding: 0;
  background: transparent;
}

.mobile-doc-markdown a,
.ctm-doc-review-link {
  color: var(--blue);
  text-decoration: none;
}

.mobile-doc-markdown a:focus-visible,
.ctm-doc-review-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.detail-messages .msg,
.detail-messages .review-msg,
.detail-messages .turn,
.message-row {
  box-sizing: border-box;
  max-width: 100%;
  margin-bottom: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  overflow-wrap: anywhere;
}

.detail-messages .prompt-turn {
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 0 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 32%, var(--line));
  border-left: 3px solid var(--blue);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 7%, var(--bg-elev)) 0%, var(--bg-elev) 82%),
    var(--bg-elev);
  overflow: hidden;
}

.detail-messages .prompt-turn.setup-turn {
  margin-bottom: 10px;
  border-color: color-mix(in srgb, var(--purple, #bb9af7) 34%, var(--line));
  border-left-color: var(--purple, #bb9af7);
  background: color-mix(in srgb, var(--purple, #bb9af7) 5%, var(--bg-elev));
}

.detail-messages .prompt-turn.live-prompt-turn {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  border-left-color: var(--green);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 7%, var(--bg-elev)) 0%, var(--bg-elev) 82%),
    var(--bg-elev);
}

.detail-messages .prompt-turn-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 8px;
  row-gap: 5px;
  padding: 10px 10px 9px 8px;
  cursor: pointer;
}

.detail-messages .prompt-turn-header:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  border-radius: 12px 12px 0 0;
}

.detail-messages .prompt-turn-chevron {
  display: inline-block;
  margin-top: 19px;
  color: var(--fg-muted);
  font-size: 10px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.detail-messages .prompt-turn.expanded .prompt-turn-chevron {
  transform: rotate(90deg);
}

.detail-messages .prompt-turn.setup-turn .prompt-turn-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}

.detail-messages .prompt-turn.setup-turn .prompt-turn-chevron {
  display: inline-block;
  color: var(--fg-muted);
  font-size: 10px;
  transition: transform 0.16s ease;
}

.detail-messages .prompt-turn.setup-turn.expanded .prompt-turn-chevron {
  transform: rotate(90deg);
}

.detail-messages .prompt-turn.setup-turn .prompt-turn-header .prompt-turn-setup-title {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.25;
}

.detail-messages .prompt-turn-head-main {
  min-width: 0;
}

.detail-messages .prompt-turn-prompt.review-msg {
  width: 100%;
  margin: 0;
  padding: 9px 10px;
  border-color: rgba(113, 167, 255, 0.46);
  border-left-width: 2px;
  border-radius: 8px;
  background: rgba(113, 167, 255, 0.14);
  box-shadow: 0 1px 0 rgba(113, 167, 255, 0.08) inset;
}

.detail-messages .prompt-turn-prompt.review-msg.subagent-prompt {
  border-color: color-mix(in srgb, var(--amber) 48%, var(--line));
  background: color-mix(in srgb, var(--amber) 12%, var(--bg-soft));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--amber) 14%, transparent) inset;
}

.detail-messages .live-prompt-turn .prompt-turn-prompt.review-msg {
  border-color: color-mix(in srgb, var(--green) 38%, var(--line));
  background: color-mix(in srgb, var(--green) 11%, var(--bg-soft));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--green) 12%, transparent) inset;
}

.detail-messages .prompt-turn-live-title {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--green) 34%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--green) 8%, var(--bg-soft));
}

.detail-messages .prompt-turn-live-title > span:first-child,
.detail-messages .prompt-turn-live-title .live-terminal-kicker {
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-messages .live-terminal-prompt-title {
  gap: 6px;
}

.detail-messages .live-terminal-helper {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
}

.detail-messages .prompt-turn-live-title .live-terminal-prompt-text {
  padding-top: 2px;
}

.detail-messages .terminal-choice-title {
  gap: 8px;
}

.terminal-choice-context {
  margin: 1px 0 0;
  color: var(--fg);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}

.terminal-choice-context.muted {
  color: var(--fg-dim);
  font-weight: 600;
}

.terminal-choice-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 2px;
}

.terminal-choice-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--green) 12%, var(--bg-elev));
  color: var(--fg);
  text-align: left;
  font: inherit;
}

.terminal-choice-button.selected {
  border-color: color-mix(in srgb, var(--green) 72%, var(--line));
  background: color-mix(in srgb, var(--green) 18%, var(--bg-elev));
}

.terminal-choice-button.checked {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--green));
}

.terminal-choice-button.pending,
.terminal-choice-submit.pending {
  border-color: color-mix(in srgb, var(--accent) 66%, var(--green));
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-elev));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.terminal-choice-button:active {
  transform: translateY(1px);
}

.terminal-choice-button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.terminal-choice-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 24%, var(--bg-soft));
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.terminal-choice-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.2;
}

.terminal-choice-check {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 7px;
  border: 1px solid color-mix(in srgb, var(--green) 58%, var(--line));
  border-radius: 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  vertical-align: -2px;
}

.terminal-choice-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
  border: 1px solid color-mix(in srgb, var(--accent) 64%, var(--line));
  border-radius: 10px;
  background: var(--accent);
  color: #111827;
  font: inherit;
  font-weight: 900;
}

.terminal-choice-submit:active {
  transform: translateY(1px);
}

.detail-messages .prompt-turn-prompt .msg-header {
  margin-bottom: 5px;
}

.detail-messages .prompt-turn-header .prompt-turn-prompt,
.detail-messages .prompt-turn-header .prompt-turn-prompt .msg-text,
.detail-messages .prompt-turn-header .prompt-turn-prompt .msg-text *,
.detail-messages .prompt-turn-header .live-terminal-prompt-text,
.detail-messages .prompt-turn-header .live-terminal-prompt-text * {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.detail-messages .prompt-turn-header .prompt-turn-meta,
.detail-messages .prompt-turn-header .prompt-turn-prompt .msg-header {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.detail-messages .prompt-turn-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 4px;
  min-height: 18px;
  margin: 0;
  grid-column: 2;
}

.detail-messages .prompt-turn:not(.setup-turn) .prompt-turn-meta {
  display: flex;
}

.detail-messages .prompt-turn.setup-turn .prompt-turn-meta {
  margin: 0;
  justify-content: flex-end;
}

.detail-messages .prompt-turn-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--fg-muted);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.detail-messages .prompt-turn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--blue) 42%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 14%, var(--bg-soft));
  color: var(--blue);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.detail-messages .live-prompt-turn .prompt-turn-action {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 15%, var(--bg-soft));
  color: var(--green);
}

.detail-messages .live-prompt-turn .live-terminal-submit-action {
  min-height: 26px;
  gap: 6px;
  padding: 4px 10px 4px 7px;
  border-color: color-mix(in srgb, var(--green) 62%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 23%, var(--bg-soft)), color-mix(in srgb, var(--green) 11%, var(--bg-elev)));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--green) 12%, transparent) inset,
    0 6px 16px color-mix(in srgb, var(--green) 13%, transparent);
  font-size: 11px;
  letter-spacing: 0.01em;
}

.detail-messages .live-terminal-submit-action .live-terminal-submit-icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 28%, transparent);
  color: color-mix(in srgb, var(--green) 88%, white);
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}

.detail-messages .live-terminal-submit-action:disabled {
  cursor: default;
  opacity: 0.78;
}

.detail-messages .live-terminal-submit-action.sent {
  border-color: color-mix(in srgb, var(--green) 78%, var(--line));
  background: color-mix(in srgb, var(--green) 72%, white);
  color: #111827;
}

.detail-messages .live-terminal-submit-action.sent .live-terminal-submit-icon {
  background: rgba(17, 24, 39, 0.18);
  color: #111827;
}

.detail-messages .prompt-turn-action:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.detail-messages .prompt-turn-alert.warning {
  color: var(--amber);
  border-color: rgba(229, 181, 103, 0.5);
  background: rgba(229, 181, 103, 0.10);
}

.detail-messages .prompt-turn-alert.error {
  color: var(--red);
  border-color: rgba(255, 91, 106, 0.52);
  background: rgba(255, 91, 106, 0.10);
}

.detail-messages .prompt-turn-response {
  display: none;
  margin-top: 0;
  padding: 0 10px 10px 27px;
  border-top: 1px solid color-mix(in srgb, var(--blue) 20%, var(--line));
}

.detail-messages .prompt-turn.expanded .prompt-turn-response {
  display: block;
}

.detail-messages .prompt-turn-response > .review-msg,
.detail-messages .prompt-turn-response > .thought-group {
  margin: 8px 0 0;
}

.detail-messages .prompt-turn-response > .review-msg.assistant,
.detail-messages .terminal-tail-panel {
  border-radius: 10px;
}

.detail-messages .prompt-turn-empty,
.detail-messages .prompt-turn-setup-title {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--fg-dim);
  font-size: 12px;
}

.detail-messages .prompt-turn-setup-title {
  color: var(--fg);
  font-weight: 700;
}

.detail-messages .review-msg.user {
  background: rgba(113, 167, 255, 0.06);
  border-color: rgba(113, 167, 255, 0.25);
}

.detail-messages .review-msg.assistant {
  background: var(--bg-elev);
}

.detail-messages .review-msg.walle-error-msg {
  background: color-mix(in srgb, var(--red) 8%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
}

.message-row.self {
  max-width: calc(100% - 28px);
  margin-left: 28px;
  border-color: rgba(113, 167, 255, 0.45);
  background: rgba(113, 167, 255, 0.11);
}

.message-row.assistant,
.message-row.system,
.message-row.tool {
  max-width: calc(100% - 16px);
  margin-right: 16px;
}

.message-row.event {
  background: var(--bg-soft);
}

.message-row.live-tail-row {
  border-color: rgba(113, 167, 255, 0.5);
  background: rgba(113, 167, 255, 0.08);
}

.message-row.live-terminal-turn {
  margin-bottom: 8px;
}

.message-row.self.live-terminal-turn {
  border-color: rgba(151, 214, 119, 0.38);
  background: rgba(151, 214, 119, 0.09);
}

.message-row.assistant.live-terminal-turn {
  border-color: rgba(113, 167, 255, 0.38);
}

.detail-messages .mobile-final-summary-card,
.message-row.mobile-final-summary-card {
  max-width: 100%;
  margin: 12px 0 14px;
  padding: 13px 14px 14px;
  border: 1px solid color-mix(in srgb, var(--green) 42%, var(--line));
  border-left: 4px solid var(--green);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 10%, var(--bg-elev)) 0%, var(--bg-elev) 78%),
    var(--bg-elev);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
  cursor: text;
}

.detail-messages .prompt-turn.has-final-summary {
  border-color: color-mix(in srgb, var(--green) 36%, var(--line));
  border-left-color: var(--green);
}

.detail-messages .prompt-turn-response > .mobile-final-summary-card {
  margin-top: 10px;
}

.detail-messages .mobile-final-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  text-transform: none;
}

.mobile-final-summary-title {
  display: inline-grid;
  gap: 3px;
  min-width: 0;
  color: var(--fg);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.2;
}

.mobile-final-summary-kicker {
  width: fit-content;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--green) 48%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 14%, var(--bg-soft));
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  text-transform: uppercase;
}

.mobile-final-summary-meta {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 46%;
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
}

.detail-messages .mobile-final-summary-card .mobile-final-summary-body,
.detail-messages .review-msg.mobile-final-summary-card .msg-text,
.message-row.mobile-final-summary-card .message-body {
  display: block;
  max-height: none;
  color: var(--fg);
  line-height: 1.58;
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.detail-messages .mobile-final-summary-card .msg-text h1,
.detail-messages .mobile-final-summary-card .msg-text h2,
.detail-messages .mobile-final-summary-card .msg-text h3,
.detail-messages .mobile-final-summary-card .message-body h1,
.detail-messages .mobile-final-summary-card .message-body h2,
.detail-messages .mobile-final-summary-card .message-body h3 {
  margin-top: 12px;
}

.detail-messages .mobile-final-summary-card .msg-text ul,
.detail-messages .mobile-final-summary-card .msg-text ol,
.detail-messages .mobile-final-summary-card .message-body ul,
.detail-messages .mobile-final-summary-card .message-body ol {
  margin-bottom: 10px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid rgba(151, 214, 119, 0.55);
  border-radius: 999px;
  color: var(--green);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
}

.terminal-tail-panel {
  box-sizing: border-box;
  max-width: calc(100% - 18px);
  margin: 12px 18px 12px 0;
  border: 1px solid color-mix(in srgb, var(--green) 34%, var(--line));
  border-radius: 14px 14px 14px 4px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 10%, var(--bg-elev)) 0%, var(--bg-elev) 78%),
    var(--bg-elev);
  box-shadow:
    inset 3px 0 0 color-mix(in srgb, var(--green) 70%, transparent),
    0 8px 24px rgba(0, 0, 0, 0.10);
  overflow: hidden;
}

.terminal-tail-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.terminal-tail-summary::-webkit-details-marker {
  display: none;
}

.terminal-tail-summary::before {
  content: "▸";
  flex: 0 0 auto;
  color: var(--green);
  font-size: 11px;
  transition: transform 0.16s ease;
}

.terminal-tail-panel[open] > .terminal-tail-summary::before {
  transform: rotate(90deg);
}

.terminal-tail-main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.terminal-tail-kicker {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.terminal-tail-preview {
  min-width: 0;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.terminal-tail-meta {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
  font-size: 10px;
  white-space: nowrap;
}

.terminal-tail-body {
  max-height: min(360px, 42vh);
  margin: 0;
  padding: 11px 13px 13px;
  border-top: 1px solid color-mix(in srgb, var(--green) 22%, var(--line));
  overflow: auto;
  overscroll-behavior: contain;
}

.live-tail-text {
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  font: inherit;
  color: var(--fg);
}

.live-terminal-prompt-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--fg);
  font-weight: 750;
}

.detail-messages .msg-header,
.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.message-head {
  color: var(--fg-dim);
  font-weight: 800;
  text-transform: uppercase;
}

.detail-messages .msg-role {
  font-weight: 700;
  color: var(--fg);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.detail-messages .review-msg.user .msg-role { color: var(--blue); }
.detail-messages .review-msg.subagent-prompt .msg-role { color: var(--amber); }
.detail-messages .review-msg.walle-error-msg .msg-role { color: var(--red); }

.detail-messages .msg-time {
  color: var(--fg-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.message-time {
  flex: 0 0 auto;
  color: var(--fg-muted);
  font-weight: 700;
  text-transform: none;
}

.detail-messages .msg-cmd-badge {
  background: rgba(113, 167, 255, 0.15);
  color: var(--blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-messages .msg-text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
}

.message-body {
  min-width: 0;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: break-word;
  word-break: normal;
}

.detail-messages .msg-text > img,
.detail-messages .msg-text :where(p, li, figure) > img,
.message-body > img,
.message-body :where(p, li, figure) > img,
.mobile-doc-markdown > img,
.mobile-doc-markdown :where(p, li, figure) > img {
  box-sizing: border-box;
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(62vh, 620px);
  object-fit: contain;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.detail-messages .msg-attachment-strip,
.message-row .msg-attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.detail-messages .msg-image-attachment,
.message-row .msg-image-attachment {
  display: inline-grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(100%, 300px);
  min-height: 72px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 7%, var(--bg-elev));
  color: var(--fg);
  text-decoration: none;
}

.detail-messages .msg-image-attachment:active,
.message-row .msg-image-attachment:active {
  transform: translateY(1px);
}

.detail-messages .msg-image-attachment img,
.message-row .msg-image-attachment img {
  width: 86px;
  height: 64px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  object-fit: cover;
  background: var(--bg);
}

.detail-messages .msg-image-attachment span,
.message-row .msg-image-attachment span {
  min-width: 0;
  overflow: hidden;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-messages .msg-text > :first-child { margin-top: 0; }
.detail-messages .msg-text > :last-child { margin-bottom: 0; }
.message-body > :first-child { margin-top: 0; }
.message-body > :last-child { margin-bottom: 0; }

.detail-messages .msg-text p,
.message-body p {
  margin: 0 0 8px;
}

.detail-messages .msg-text h1,
.detail-messages .msg-text h2,
.detail-messages .msg-text h3,
.detail-messages .msg-text h4,
.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 {
  margin: 14px 0 6px;
  line-height: 1.3;
  color: var(--fg);
}

.detail-messages .msg-text h1 { font-size: 18px; font-weight: 700; }
.detail-messages .msg-text h2 { font-size: 16px; font-weight: 700; }
.detail-messages .msg-text h3 { font-size: 14px; font-weight: 700; }
.detail-messages .msg-text h4 { font-size: 13px; font-weight: 600; color: var(--fg-dim); }
.message-body h1 { font-size: 18px; font-weight: 700; }
.message-body h2 { font-size: 16px; font-weight: 700; }
.message-body h3 { font-size: 14px; font-weight: 700; }
.message-body h4 { font-size: 13px; font-weight: 600; color: var(--fg-dim); }

.detail-messages .msg-text ul,
.detail-messages .msg-text ol,
.message-body ul,
.message-body ol {
  margin: 8px 0 12px;
  padding-left: 0;
  list-style: none;
}

.detail-messages .msg-text li,
.message-body li {
  position: relative;
  margin: 7px 0;
  padding-left: 22px;
}

.detail-messages .msg-text li > p,
.message-body li > p {
  margin: 0 0 6px;
}

.detail-messages .msg-text li > :last-child,
.message-body li > :last-child {
  margin-bottom: 0;
}

.detail-messages .msg-text ul > li::before,
.message-body ul > li::before {
  content: "";
  position: absolute;
  top: 0.78em;
  left: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-dim);
  transform: translateY(-50%);
}

.detail-messages .msg-text ol,
.message-body ol {
  counter-reset: mobile-list;
}

.detail-messages .msg-text ol > li,
.message-body ol > li {
  counter-increment: mobile-list;
  padding-left: 30px;
}

.detail-messages .msg-text ol > li::before,
.message-body ol > li::before {
  content: counter(mobile-list) ".";
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  color: var(--fg-dim);
  font-weight: 700;
  text-align: right;
}

.detail-messages .msg-text li ul,
.detail-messages .msg-text li ol,
.message-body li ul,
.message-body li ol {
  margin: 6px 0 4px;
}

.detail-messages .msg-text strong,
.message-body strong { font-weight: 700; color: var(--fg); }
.detail-messages .msg-text em,
.message-body em { font-style: italic; color: var(--fg); }

.detail-messages .msg-text a,
.message-body a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-messages .msg-text hr,
.message-body hr {
  border: 0;
  width: min(42%, 132px);
  border-top: 1px solid var(--line-strong);
  margin: 16px auto;
  opacity: 0.7;
}

.detail-messages .msg-text hr + hr,
.message-body hr + hr {
  display: none;
}

.detail-messages .msg-text blockquote,
.message-body blockquote {
  margin: 10px 0;
  padding: 7px 10px 7px 12px;
  border-left: 3px solid rgba(113, 167, 255, 0.5);
  border-radius: 0 6px 6px 0;
  background: rgba(113, 167, 255, 0.07);
  color: var(--fg-dim);
}

.detail-messages .msg-text table,
.message-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-messages .msg-text thead,
.message-body thead {
  background: var(--bg-soft);
}

.detail-messages .msg-text th,
.detail-messages .msg-text td,
.message-body th,
.message-body td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.detail-messages .msg-text th,
.message-body th { font-weight: 600; color: var(--fg); }

.detail-messages pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}

.detail-messages pre code {
  background: transparent;
  padding: 0;
  border: 0;
  color: var(--fg);
  font-size: 12px;
}

.detail-messages code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--fg);
  word-break: normal;
  overflow-wrap: anywhere;
}

.detail-messages .tool-badge {
  display: inline-block;
  background: rgba(229, 181, 103, 0.18);
  color: var(--amber);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  margin: 0 2px;
}

/* Thought-group collapsed rows (tool activity, multi-step responses) */
.detail-messages .thought-group {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
}

.detail-messages .thought-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}

.detail-messages .thought-group-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--fg-dim);
}

.detail-messages .thought-group.codex-warning-group {
  border-color: rgba(234, 179, 8, 0.28);
  background: rgba(234, 179, 8, 0.045);
}

.detail-messages .thought-group.codex-warning-group .thought-group-label,
.detail-messages .codex-warning-item .msg-role {
  color: var(--warn, #e0af68);
}

.detail-messages .thought-chevron {
  display: inline-block;
  font-size: 9px;
  transition: transform 0.15s ease;
  color: var(--fg-muted);
}

.detail-messages .thought-group.expanded .thought-chevron {
  transform: rotate(90deg);
}

.detail-messages .thought-group-count {
  color: var(--fg-muted);
  font-size: 11px;
}

.detail-messages .thought-group-preview {
  flex: 1;
  min-width: 0;
  color: var(--fg-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-messages .thought-group-time {
  color: var(--fg-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.detail-messages .thought-group-items {
  display: none;
  margin-top: 8px;
}

.detail-messages .thought-group.expanded .thought-group-items {
  display: block;
}

.detail-messages .thought-group-items .review-msg {
  margin-bottom: 6px;
  background: var(--bg-elev);
}

.detail-messages .thought-group.codex-warning-group .thought-group-items .review-msg {
  background: rgba(234, 179, 8, 0.04);
}

.detail-messages .codex-warning-item .msg-header {
  gap: 8px;
}

.detail-messages .codex-warning-item .thought-preview {
  flex: 1;
  min-width: 0;
  color: var(--fg-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-messages .codex-warning-repeat {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.28);
  color: var(--warn, #e0af68);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* Skill-body and local-cmd collapsed rows (+ structured-capture cards) */
.detail-messages .review-msg.skill-body,
.detail-messages .review-msg.local-cmd,
.detail-messages .review-msg.tool-result,
.detail-messages .review-msg.tool-card,
.detail-messages .review-msg.thinking-block,
.detail-messages .review-msg.summary {
  cursor: pointer;
  background: var(--bg-soft);
}

.detail-messages .review-msg.skill-body .msg-text,
.detail-messages .review-msg.local-cmd .msg-text,
.detail-messages .review-msg.tool-result .msg-text,
.detail-messages .review-msg.tool-card .msg-text,
.detail-messages .review-msg.thinking-block .msg-text,
.detail-messages .review-msg.summary .msg-text {
  display: none;
  margin-top: 8px;
}

.detail-messages .review-msg.skill-body.expanded .msg-text,
.detail-messages .review-msg.local-cmd.expanded .msg-text,
.detail-messages .review-msg.tool-result.expanded .msg-text,
.detail-messages .review-msg.tool-card.expanded .msg-text,
.detail-messages .review-msg.thinking-block.expanded .msg-text,
.detail-messages .review-msg.summary.expanded .msg-text {
  display: block;
}

.detail-messages .review-msg.skill-body .thought-chevron,
.detail-messages .review-msg.local-cmd .thought-chevron,
.detail-messages .review-msg.tool-result .thought-chevron,
.detail-messages .review-msg.tool-card .thought-chevron,
.detail-messages .review-msg.thinking-block .thought-chevron,
.detail-messages .review-msg.summary .thought-chevron {
  display: inline-block;
  transition: transform 0.15s ease;
}

/* Structured-capture extras on mobile: compact divider + hide the hover-only
   raw-JSON inspector (no hover on touch). */
.detail-messages .compact-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.detail-messages .compact-divider-line { flex: 1; height: 1px; background: var(--border); }
.detail-messages .compact-divider-label { font-size: 10px; color: var(--fg-dim); text-transform: uppercase; }
.detail-messages .msg-raw-btn { display: none; }

.detail-messages .review-msg.skill-body.expanded .thought-chevron,
.detail-messages .review-msg.local-cmd.expanded .thought-chevron,
.detail-messages .review-msg.tool-result.expanded .thought-chevron,
.detail-messages .review-msg.summary.expanded .thought-chevron {
  transform: rotate(90deg);
}

.detail-messages .thought-preview {
  flex: 1;
  min-width: 0;
  color: var(--fg-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-messages .msg-expand {
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  min-height: 28px;
}

.detail-messages .msg-text.collapsed {
  max-height: 220px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
}

/* Stream-event fallback (article.message-row): used when MR can't render
   an event. Style its <strong> label like a msg-role and <p> like msg-text
   so it visually fits beside .review-msg cards. */
.detail-messages article.message-row > strong {
  display: block;
  font-weight: 700;
  font-size: 12px;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.detail-messages article.message-row > p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer {
  position: relative;
  z-index: 42;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: start;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-elev) 88%, transparent), var(--bg)),
    var(--bg);
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.18);
}

.composer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--blue) 36%, var(--line)), transparent);
  opacity: 0.65;
}

.composer.has-model-picker {
  grid-template-columns: minmax(0, 1fr) 58px 52px;
}

.composer-field {
  position: relative;
  align-self: start;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.composer-attachments {
  display: grid;
  gap: 6px;
}

.composer-attachments[hidden] {
  display: none;
}

.attachment-chip {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 6px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.attachment-chip-preview {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: rgba(113, 167, 255, 0.12);
  color: var(--blue);
  font-weight: 900;
  overflow: hidden;
}

.attachment-chip-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-chip-main {
  min-width: 0;
}

.attachment-chip-title,
.attachment-chip-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-title {
  color: var(--fg);
  font-size: 13px;
  font-weight: 800;
}

.attachment-chip-meta {
  margin-top: 2px;
  color: var(--fg-dim);
  font-size: 11px;
}

.attachment-remove {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 18px;
  line-height: 1;
}

.composer-editor,
.field-label textarea,
.field-label select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--fg);
}

.composer-editor {
  min-height: 52px;
  max-height: min(34vh, 168px);
  padding: 13px 52px 13px 13px;
  line-height: 1.35;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  caret-color: var(--blue);
  user-select: text;
  -webkit-user-select: text;
  overscroll-behavior: contain;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.composer-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--fg-muted);
  pointer-events: none;
}

.composer-editor:focus {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 20%, transparent);
}

.composer-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 22px;
  line-height: 1;
}

.composer-clear:active {
  background: var(--bg-soft);
  color: var(--fg);
}

.composer-clear[hidden] {
  display: none;
}

.prompt-history-strip {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 42%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 16%, transparent), transparent 58%),
    color-mix(in srgb, var(--bg-elev) 94%, var(--blue));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--fg) 8%, transparent),
    0 8px 22px rgba(0, 0, 0, 0.2);
}

.prompt-history-strip[hidden] {
  display: none;
}

.prompt-history-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.prompt-history-copy strong {
  color: var(--fg);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.prompt-history-copy span {
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.prompt-history-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 0.85fr 44px;
  gap: 7px;
  align-items: center;
}

.prompt-history-actions button {
  min-width: 0;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-soft) 86%, var(--blue));
  color: var(--fg);
  font-size: 12px;
  font-weight: 900;
}

.prompt-history-actions button:disabled {
  opacity: 0.46;
}

#prompt-history-edit {
  background: var(--blue);
  color: #08111f;
}

#prompt-history-close {
  padding: 0;
  background: transparent;
  color: var(--fg-dim);
  font-size: 22px;
  line-height: 1;
}

.mobile-skill-picker {
  position: absolute;
  left: 0;
  right: -64px;
  bottom: calc(100% + 8px);
  z-index: 48;
  max-height: min(46vh, 260px);
  overflow-y: auto;
  border: 1px solid rgba(113, 167, 255, 0.55);
  border-radius: 8px;
  background: rgba(21, 27, 34, 0.98);
  box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.36);
  -webkit-overflow-scrolling: touch;
}

.mobile-skill-picker[hidden] {
  display: none;
}

.mobile-skill-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(51, 64, 77, 0.7);
  background: transparent;
  color: var(--fg);
  text-align: left;
}

.mobile-skill-item:last-child {
  border-bottom: 0;
}

.mobile-skill-item.active {
  background: rgba(113, 167, 255, 0.16);
}

.mobile-skill-name {
  min-width: 0;
  color: var(--fg);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-skill-desc {
  grid-column: 1 / -1;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-skill-meta {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.composer-status {
  min-height: 16px;
  padding-left: 2px;
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.composer-status.ok {
  color: var(--green);
}

.composer-status.error {
  color: var(--red);
}

.remote-submission-row {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  color: var(--fg);
}

.remote-submission-row.pending {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--border));
}

.remote-submission-row.attention {
  border-color: color-mix(in srgb, var(--red) 52%, var(--border));
  background: color-mix(in srgb, var(--red) 8%, var(--panel-2));
}

.remote-submission-head {
  margin-bottom: 4px;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.remote-submission-message {
  color: var(--fg);
  font-size: 13px;
  line-height: 1.35;
}

.remote-submission-preview {
  margin-top: 8px;
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.remote-submission-repeat {
  margin-top: 8px;
  color: var(--fg-soft);
  font-size: 11px;
  line-height: 1.35;
}

.send-btn {
  align-self: start;
  display: grid;
  place-items: center;
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--fg) 14%, transparent);
  font-size: 18px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--ink) 18%, transparent),
    0 8px 20px rgba(0, 0, 0, 0.2);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.send-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.18);
}

.send-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.send-btn.hold-only {
  background: var(--bg-elev-2);
  color: var(--fg);
  border: 1px solid var(--line-strong);
}

.model-picker-btn {
  align-self: start;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  width: 58px;
  min-width: 58px;
  height: 52px;
  min-height: 52px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--blue) 36%, var(--line-strong));
  border-radius: 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 12%, transparent), transparent),
    color-mix(in srgb, var(--bg-elev-2) 92%, transparent);
  color: var(--fg);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 9%, transparent);
}

.model-picker-btn[hidden] {
  display: none;
}

.model-picker-btn:active,
.model-picker-btn:focus-visible,
.model-picker-btn[aria-expanded="true"] {
  outline: none;
  border-color: var(--blue);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 22%, transparent), transparent),
    color-mix(in srgb, var(--bg-elev-2) 88%, var(--blue));
}

.model-picker-btn-kicker,
.model-picker-btn-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.05;
  text-align: center;
}

.model-picker-btn-kicker {
  color: var(--fg-muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.model-picker-btn-label {
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
}

.send-menu {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(var(--mobile-keyboard-offset, 0px) + env(safe-area-inset-bottom) + 96px);
  z-index: 52;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--blue) 10%, transparent), transparent 44%),
    color-mix(in srgb, var(--bg-elev) 96%, #000);
  box-shadow:
    0 -20px 50px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 color-mix(in srgb, var(--fg) 8%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.send-menu[hidden] {
  display: none;
}

.send-menu::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg-muted) 55%, transparent);
  transform: translateX(-50%);
}

.send-menu-header {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding: 8px 6px 2px;
}

.send-menu-header strong,
.send-menu-header span {
  display: block;
}

.send-menu-header strong {
  color: var(--fg);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.send-menu-header span {
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.send-menu-item {
  width: 100%;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--fg-muted) 18%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-soft) 86%, transparent);
  color: var(--fg);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.send-menu-item.warn {
  color: var(--red);
}

.send-menu-model {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  color: var(--blue);
  text-align: left;
}

.send-menu-model[hidden] {
  display: none;
}

.send-menu-queue {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  color: var(--blue);
  text-align: left;
}

.send-menu-item-kicker,
.send-menu-item-main {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-menu-item-kicker {
  color: var(--fg-dim);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.send-menu-item-main {
  color: var(--blue);
  font-size: 14px;
  font-weight: 950;
}

.send-menu-item[data-send-menu-attach] {
  color: var(--blue);
}

.send-menu-item[data-send-menu-control] {
  color: var(--fg);
}

.send-menu-item[data-send-menu-copy] {
  color: var(--green);
}

.send-menu-item[data-send-menu-queue] {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--blue) 14%, transparent), transparent 72%),
    color-mix(in srgb, var(--bg-soft) 88%, transparent);
}

.send-menu-item + .send-menu-item {
  margin-top: 0;
}

.send-menu-item:active,
.send-menu-item:focus-visible {
  background: color-mix(in srgb, var(--blue) 16%, var(--bg-soft));
  outline: none;
}

.mobile-search-shell {
  display: grid;
  gap: 6px;
  padding: 6px 16px 10px;
}

.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 38px;
  align-items: center;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
}

.search-icon {
  justify-self: end;
  color: var(--fg-muted);
  font-size: 15px;
  font-weight: 900;
}

.search-box input {
  min-width: 0;
  height: 48px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  outline: none;
}

.search-box input::placeholder {
  color: var(--fg-muted);
}

.search-box:focus-within {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent);
}

.search-clear {
  justify-self: center;
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  min-height: 44px;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
}

.mobile-search-shell.has-query .search-clear {
  opacity: 1;
  pointer-events: auto;
}

.search-clear:active {
  background: var(--bg-soft);
  color: var(--fg);
}

.search-status {
  min-height: 15px;
  padding: 0 2px;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.search-suggestions {
  display: grid;
  gap: 13px;
  padding: 0 16px 14px;
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestion-group {
  display: grid;
  gap: 8px;
}

.search-suggestion-title {
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.search-suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.1;
}

.search-suggestion-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-suggestion-chip small {
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.search-suggestion-chip:active {
  border-color: color-mix(in srgb, var(--blue) 62%, var(--line-strong));
  background: var(--bg-soft);
}

.search-empty-panel {
  display: grid;
  gap: 7px;
  margin: 0 16px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg-dim);
  line-height: 1.4;
}

.search-suggestions .search-empty-panel {
  margin: 0;
}

.search-empty-panel strong {
  color: var(--fg);
  font-size: 15px;
}

.search-empty-panel code {
  color: var(--blue);
  font: inherit;
  font-weight: 900;
}

.search-result-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.3;
}

.search-result-summary strong {
  color: var(--fg);
}

.search-result-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-result-title-line .result-title {
  flex: 1 1 132px;
}

.search-match-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  margin-top: 7px;
  padding: 3px 7px;
  border: 1px solid rgba(113, 167, 255, 0.34);
  border-radius: 6px;
  background: rgba(113, 167, 255, 0.10);
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.walle-row,
.more-row {
  grid-template-columns: 1fr auto;
}

.more-row-main {
  min-width: 0;
}

.more-row > div,
.more-row > span {
  min-width: 0;
}

.more-action-row {
  align-items: center;
  gap: 14px;
}

.more-action-row .row-action {
  align-self: center;
  min-width: 92px;
  min-height: 44px;
  padding-inline: 16px;
}

.more-action-card .row-action {
  min-height: 44px;
}

.restart-row {
  grid-template-columns: 1fr;
  padding-block: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 10%, transparent), transparent 56%),
    var(--bg);
}

.restart-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.restart-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.restart-header .row-action {
  min-height: 44px;
  min-width: 104px;
}

.restart-notice {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, var(--blue));
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-elev) 86%, var(--blue));
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.35;
}

.restart-notice-title {
  color: var(--fg);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.restart-notice.blocked {
  border-color: color-mix(in srgb, var(--red) 42%, var(--line));
  background: color-mix(in srgb, var(--bg-elev) 82%, var(--red));
}

.restart-notice.error {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
}

.restart-notice.success {
  border-color: color-mix(in srgb, var(--green) 42%, var(--line));
  background: color-mix(in srgb, var(--bg-elev) 84%, var(--green));
}

.restart-notice .row-action {
  justify-self: stretch;
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 360px) {
  .restart-header {
    grid-template-columns: 1fr;
  }

  .restart-header .row-action {
    width: 100%;
  }
}

.push-row {
  grid-template-columns: 1fr;
  padding-block: 16px;
}

.push-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.push-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
  width: 100%;
}

.push-actions .row-action {
  min-width: 0;
  min-height: 44px;
  width: 100%;
}

.push-actions .primary-action {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--fg) 18%, transparent);
}

.push-unavailable-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.35;
}

.push-unavailable-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 204, 102, 0.32);
  border-radius: 999px;
  background: rgba(255, 204, 102, 0.10);
  color: #ffd27d;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.more-shell {
  display: grid;
  gap: 12px;
  padding: 12px 16px 24px;
}

.more-hero-card,
.more-section-card,
.more-action-card {
  border: 1px solid color-mix(in srgb, var(--line) 86%, var(--blue));
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-elev) 92%, var(--bg));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 6%, transparent);
}

.more-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 12%, transparent), transparent 46%),
    color-mix(in srgb, var(--bg-elev) 94%, var(--bg));
}

.more-hero-copy {
  min-width: 0;
}

.more-kicker {
  display: block;
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.more-hero-card h2,
.more-section-card h3 {
  margin-top: 4px;
  color: var(--fg);
}

.more-hero-card p,
.more-section-copy {
  margin-top: 6px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.4;
}

.more-scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.more-section-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.more-section-head,
.more-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.more-section-head > span,
.more-action-card > span:first-child {
  min-width: 0;
}

.more-action-card {
  width: 100%;
  min-height: 72px;
  padding: 14px;
  color: inherit;
  text-align: left;
  text-decoration: none;
}

button.more-action-card {
  cursor: pointer;
}

.more-action-card:active {
  background: color-mix(in srgb, var(--blue) 8%, var(--bg-elev));
}

.more-action-card.inline-danger {
  border-color: color-mix(in srgb, var(--red) 24%, var(--line));
  background: color-mix(in srgb, var(--bg-elev) 90%, var(--red) 4%);
}

.more-danger-card {
  border-color: color-mix(in srgb, var(--red) 22%, var(--line));
}

.more-section-card .restart-notice {
  margin-top: 2px;
}

.more-section-card .push-main {
  display: grid;
  gap: 10px;
}

.more-section-card .push-actions {
  margin-top: 0;
}

.switch-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.3;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.quiet-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quiet-row label {
  display: grid;
  gap: 5px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 800;
}

.quiet-row input {
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
}

#view-walle.mobile-view {
  min-height: calc(100dvh - var(--nav-h) - 72px - env(safe-area-inset-top));
  height: calc(100dvh - var(--nav-h) - 72px - env(safe-area-inset-top));
  padding: 0;
  overflow: hidden;
}

#view-walle.mobile-view.active {
  display: flex;
  flex-direction: column;
}

#walle-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.walle-chat-shell {
  display: flex;
  flex: 1;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--blue) 10%, transparent), transparent 34%),
    var(--bg);
}

.walle-chat-context {
  position: relative;
  top: auto;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 12px 12px 0;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 12%, transparent), transparent 54%),
    color-mix(in srgb, var(--bg-elev) 94%, var(--bg));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 7%, transparent);
}

.walle-context-main,
.walle-context-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.walle-context-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.walle-context-actions .row-action {
  border: 1px solid color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 14%, var(--bg-soft));
  color: var(--fg);
  text-decoration: none;
}

.walle-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--blue) 36%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--blue) 10%, var(--bg-soft));
  color: var(--blue);
  font-size: 13px;
}

.walle-context-copy {
  min-width: 0;
}

.walle-title-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.walle-title-line strong,
.walle-context-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.walle-title-line strong {
  color: var(--fg);
  font-size: 15px;
  line-height: 1.2;
}

.walle-context-copy p {
  margin: 3px 0 0;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.2;
}

.walle-session-picker-label {
  min-width: 0;
  flex: 1;
}

.walle-session-picker-label select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg);
  font-size: 13px;
  font-weight: 800;
}

.walle-chat-messages {
  flex: 1;
  min-height: 0;
  padding: 12px 12px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-health-card {
  margin: 10px 12px 0;
  border: 1px solid color-mix(in srgb, var(--blue) 26%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elev) 88%, var(--blue) 6%);
  overflow: hidden;
}

.mobile-health-card.error {
  border-color: color-mix(in srgb, var(--red) 44%, var(--line));
  background: color-mix(in srgb, var(--bg-elev) 90%, var(--red) 7%);
}

.mobile-health-card.warning {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--line));
  background: color-mix(in srgb, var(--bg-elev) 90%, var(--amber) 7%);
}

.mobile-health-header {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.mobile-health-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 14%, transparent);
}

.mobile-health-card.error .mobile-health-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 14%, transparent);
}

.mobile-health-card.warning .mobile-health-dot {
  background: var(--amber);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 16%, transparent);
}

.mobile-health-kicker {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mobile-health-copy h3 {
  margin: 2px 0 0;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.25;
}

.mobile-health-copy p {
  margin: 4px 0 0;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.42;
}

.mobile-health-meta,
.mobile-health-current-meta,
.mobile-health-more {
  margin-top: 6px;
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.mobile-health-current {
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--red) 32%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
}

.mobile-health-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.mobile-health-btn,
.mobile-health-icon-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.mobile-health-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}

.mobile-health-btn.primary {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  background: var(--blue);
  color: #07111f;
}

.mobile-health-icon-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  color: var(--fg-dim);
  font-size: 20px;
}

.mobile-health-test {
  margin: 0 12px 12px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--green) 34%, var(--line));
  border-radius: 8px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 800;
}

.mobile-health-test.error {
  border-color: color-mix(in srgb, var(--red) 40%, var(--line));
}

.mobile-health-group {
  border-top: 1px solid var(--line);
}

.mobile-health-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 900;
  list-style: none;
}

.mobile-health-group summary::-webkit-details-marker {
  display: none;
}

.mobile-health-group summary span {
  min-width: 0;
}

.mobile-health-group summary strong {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-dim);
  font-size: 11px;
}

.mobile-health-group-body {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
}

.mobile-health-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  color: var(--fg-dim);
  font-size: 12px;
  line-height: 1.35;
}

.mobile-health-row-dot {
  width: 5px;
  height: 5px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--fg-muted);
}

.mobile-health-row-copy {
  overflow-wrap: anywhere;
}

.mobile-health-row-action {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 32%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--blue) 14%, var(--bg-soft));
  color: var(--fg);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

a.mobile-health-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-health-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}

.mobile-health-link {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.walle-chat-composer {
  position: relative;
  bottom: auto;
  margin: 0;
  border-top-color: color-mix(in srgb, var(--blue) 24%, var(--line));
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.24);
}

.walle-composer-tools {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.walle-chat-composer .composer-clear {
  top: 45px;
}

.walle-tool-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 15px;
}

.walle-tool-btn:active,
.walle-tool-btn:focus-visible {
  background: var(--bg-soft);
  color: var(--blue);
}

.walle-activity-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--blue) 26%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue) 7%, var(--bg-elev));
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 800;
}

.walle-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 16%, transparent);
}

.walle-activity-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.walle-activity-copy span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.walle-empty-chat {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 380px;
  margin: 0 auto;
  padding: 56px 22px;
  text-align: center;
}

.walle-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--blue) 36%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 12%, var(--bg-soft));
  color: var(--blue);
  font-size: 16px;
}

.walle-empty-chat h3 {
  margin: 0;
  color: var(--fg);
  font-size: 19px;
  line-height: 1.2;
}

.walle-empty-chat p {
  margin: 0;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.4;
}

.walle-empty-actions {
  width: min(100%, 240px);
  padding-top: 8px;
}

.walle-empty-note {
  padding: 0 8px;
  color: var(--fg-muted);
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.54);
}

#stepup-sheet {
  z-index: 70;
}

.modal-backdrop[hidden] {
  display: none;
}

.stepup-sheet {
  width: 100%;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--bg-elev);
}

.stepup-sheet p {
  margin-top: 8px;
  color: var(--fg-dim);
  line-height: 1.45;
}

.worktree-finish-sheet {
  display: grid;
  gap: 12px;
  max-height: min(86vh, 720px);
  overflow-y: auto;
}

.worktree-finish-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}

.worktree-finish-card > div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.worktree-finish-card span,
.worktree-finish-plan strong {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.worktree-finish-card strong {
  min-width: 0;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worktree-finish-action-group,
.worktree-finish-session-picker {
  display: grid;
  gap: 8px;
}

.worktree-finish-action-group > span,
.worktree-finish-session-picker > span {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.worktree-finish-action-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.worktree-finish-action-options button {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  color: var(--fg-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.worktree-finish-action-options button[aria-checked="true"] {
  border-color: rgba(113, 167, 255, 0.82);
  background: rgba(113, 167, 255, 0.16);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px rgba(113, 167, 255, 0.22);
}

.worktree-finish-action-options button:disabled {
  opacity: 0.55;
}

.worktree-finish-session-picker select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
}

.worktree-finish-plan {
  padding: 12px;
  border: 1px solid rgba(113, 167, 255, 0.28);
  border-radius: 8px;
  background: rgba(113, 167, 255, 0.08);
}

.worktree-finish-plan ol {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.worktree-finish-plan li {
  color: var(--fg);
  font-size: 13px;
  line-height: 1.35;
}

.worktree-finish-error {
  margin-top: 0 !important;
  color: #ff7a9a !important;
  font-weight: 800;
}

.model-picker-sheet {
  width: 100%;
  max-height: min(78vh, 720px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 8%, transparent), transparent 30%),
    var(--bg-elev);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.38);
}

.model-picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
}

.model-picker-head h2,
.model-picker-head p {
  margin: 0;
}

.model-picker-head h2 {
  color: var(--fg);
  font-size: 18px;
  font-weight: 950;
}

.model-picker-head p {
  margin-top: 4px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.35;
}

.model-picker-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--fg);
  font-size: 22px;
}

.model-picker-list {
  display: grid;
  gap: 8px;
  min-height: 120px;
  max-height: 100%;
  overflow-y: auto;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}

.model-picker-empty {
  padding: 18px 4px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.4;
}

.model-picker-option {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--fg-muted) 18%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  color: var(--fg);
  text-align: left;
}

.model-picker-option[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--line-strong));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--blue) 18%, transparent), transparent 70%),
    color-mix(in srgb, var(--bg-soft) 92%, var(--blue));
}

.model-picker-option:active,
.model-picker-option:focus-visible {
  outline: none;
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 16%, var(--bg-soft));
}

.model-picker-option-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.model-picker-option-title,
.model-picker-option-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-picker-option-title {
  color: var(--fg);
  font-size: 14px;
  font-weight: 950;
}

.model-picker-option-meta {
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 750;
}

.model-picker-option-check {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 950;
}

.queue-builder-backdrop {
  justify-content: center;
}

.mobile-queue-builder-sheet {
  width: 100%;
  max-height: min(88vh, 760px);
  display: grid;
  grid-template-rows: auto auto auto minmax(120px, 1fr) auto auto;
  gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--green) 8%, transparent), transparent 30%),
    var(--bg-elev);
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.38);
}

.queue-builder-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: start;
}

.queue-builder-head h2,
.queue-builder-head p {
  margin: 0;
}

.sheet-kicker {
  margin-bottom: 4px !important;
  color: var(--green);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.queue-builder-head h2 {
  color: var(--fg);
  font-size: 18px;
  font-weight: 950;
}

.queue-builder-head p:not(.sheet-kicker) {
  margin-top: 4px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.35;
}

.queue-builder-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.queue-builder-chip {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.queue-builder-chip[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--green) 60%, var(--line));
  background: color-mix(in srgb, var(--green) 14%, var(--bg-soft));
  color: var(--green);
}

.queue-builder-chip.danger {
  color: var(--red);
}

.queue-builder-status {
  min-height: 18px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.queue-builder-status.ok {
  color: var(--green);
}

.queue-builder-status.error {
  color: var(--red);
}

.mobile-queue-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 120px;
  overflow-y: auto;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
}

.mobile-queue-empty,
.mobile-queue-loading {
  padding: 18px 4px;
  color: var(--fg-dim);
  font-size: 13px;
  line-height: 1.4;
}

.mobile-queue-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--fg-muted) 18%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-soft) 88%, transparent);
}

.mobile-queue-item.is-sent {
  opacity: 0.62;
}

.mobile-queue-item.is-collapsed {
  gap: 0;
  padding-block: 10px;
}

.mobile-queue-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.mobile-queue-item-title {
  min-width: 0;
  color: var(--fg);
  font-size: 14px;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-queue-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 850;
}

.mobile-queue-status-pill,
.mobile-queue-attachment-pill {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 65%, transparent);
}

.mobile-queue-text {
  display: -webkit-box;
  margin: 0;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.38;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  white-space: pre-wrap;
}

.mobile-queue-edit {
  display: grid;
  gap: 8px;
}

.mobile-queue-edit textarea {
  min-height: 118px;
  resize: vertical;
}

.mobile-queue-item-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mobile-queue-edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mobile-queue-item-actions button,
.mobile-queue-edit-actions button {
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  color: var(--fg-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.mobile-queue-item-actions button[data-queue-action="remove"] {
  color: var(--red);
}

.mobile-queue-item-actions button:disabled {
  opacity: 0.45;
}

.queue-builder-add-form {
  display: grid;
  gap: 8px;
}

.queue-builder-add-form label {
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.queue-builder-add-form textarea,
.mobile-queue-edit textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.queue-builder-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 700px) and (min-height: 700px) {
  .mobile-queue-builder-sheet {
    max-width: 720px;
    border-radius: 20px 20px 0 0;
  }
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.field-label {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--fg-dim);
  font-size: 12px;
  font-weight: 800;
}

.field-label textarea,
.field-label select {
  min-height: 46px;
  padding: 10px 12px;
}

.field-label textarea {
  min-height: 92px;
}

/* Pairing page */
.claim-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.claim-panel {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  padding: 24px;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.claim-panel h1 {
  margin: 8px 0 10px;
  font-size: 28px;
}

.claim-panel p {
  margin: 0 0 18px;
  color: var(--fg-dim);
  line-height: 1.5;
}

.claim-summary {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  background: var(--blue);
  color: var(--ink);
  font-weight: 800;
}

.primary-action:disabled {
  opacity: 0.55;
}

.secondary-link {
  display: block;
  min-height: 44px;
  padding-top: 16px;
  color: var(--fg-dim);
  text-align: center;
  text-decoration: none;
}

.error-text {
  color: var(--red);
}

@media (min-width: 720px) and (max-width: 899.98px) {
  .mobile-app {
    max-width: min(680px, 100vw);
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .app-topbar,
  .app-main,
  .bottom-nav,
  .status-summary {
    left: max(0px, calc((100vw - 680px) / 2));
    right: auto;
    width: min(680px, 100vw);
    transform: none;
  }

  .app-topbar,
  .app-main {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .status-summary {
    gap: 10px;
  }

  .session-row,
  .result-row,
  .device-row,
  .walle-row,
  .more-row {
    padding-inline: 20px;
  }

  .section-block,
  .home-search,
  .worktree-summary,
  .view-heading {
    padding-inline: 20px;
  }

  .detail-view {
    left: 50%;
    right: auto;
    width: min(680px, 100vw);
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .detail-messages {
    padding-inline: 18px;
  }

  .modal-backdrop {
    justify-content: center;
  }

  .stepup-sheet,
  .model-picker-sheet,
  .worktree-finish-sheet {
    width: min(640px, calc(100vw - 32px));
  }

  .model-picker-sheet {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

@media (min-width: 900px) and (min-height: 650px) {
  :root {
    --tablet-list-w: clamp(372px, 37vw, 468px);
    --tablet-single-w: min(1240px, calc(100vw - 32px));
    --tablet-topbar-h: 72px;
  }

  html {
    height: 100%;
    overflow: hidden;
    background:
      linear-gradient(90deg, var(--bg) 0, var(--bg) var(--tablet-list-w), color-mix(in srgb, var(--bg-elev) 72%, var(--bg)) var(--tablet-list-w), var(--bg) 100%);
  }

  html:not(.detail-open) {
    background: var(--bg);
  }

  body.mobile-app {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
  }

  body.detail-sheet-open {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
  }

  body.detail-sheet-open .app-main,
  body.detail-sheet-open .bottom-nav,
  body.detail-sheet-open .app-topbar {
    pointer-events: auto;
    user-select: auto;
  }

  .app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: var(--tablet-list-w);
    min-height: calc(var(--tablet-topbar-h) + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transform: none;
  }

  body.mobile-app:not(.detail-open) .app-topbar {
    left: max(0px, calc((100vw - var(--tablet-single-w)) / 2));
    width: var(--tablet-single-w);
    border-left: 1px solid var(--line);
    transform: none;
  }

  .app-main {
    position: fixed;
    top: calc(var(--tablet-topbar-h) + var(--status-tabs-h) + env(safe-area-inset-top));
    left: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
    width: var(--tablet-list-w);
    min-height: 0;
    overflow: auto;
    border-right: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-app:not([data-mobile-tab="status"]) .app-main {
    top: calc(var(--tablet-topbar-h) + env(safe-area-inset-top));
  }

  body.mobile-app.detail-open .app-main {
    bottom: 0;
  }

  body.mobile-app:not(.detail-open) .app-main {
    left: max(0px, calc((100vw - var(--tablet-single-w)) / 2));
    width: var(--tablet-single-w);
    border-left: 1px solid var(--line);
    transform: none;
  }

  .mobile-view {
    padding: 16px 0 22px;
  }

  body.mobile-app.detail-split-layout:not(.detail-open) #view-status.mobile-view.active {
    display: block;
    padding: 16px 0 22px;
  }

  body.mobile-app.detail-split-layout:not(.detail-open) #view-status #status-content {
    min-width: 0;
  }

  body.mobile-app.detail-open #view-status .status-focus-panel {
    display: none;
  }

  .status-summary {
    gap: 10px;
    padding-inline: 18px;
    top: calc(var(--tablet-topbar-h) + env(safe-area-inset-top));
    bottom: auto;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }

  #view-status .view-content {
    padding-bottom: 22px;
  }

  .summary-tile {
    min-height: 44px;
  }

  .home-search,
  .view-heading,
  .worktree-summary,
  .section-block {
    padding-inline: 18px;
  }

  .status-focus-panel {
    margin-inline: 18px;
  }

  body.mobile-app:not(.detail-open) .status-cockpit {
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
    align-items: start;
    gap: 16px;
    padding: 0 18px 18px;
  }

  body.mobile-app:not(.detail-open) .status-cockpit-column {
    display: grid;
    align-content: start;
    gap: 14px;
  }

  body.mobile-app:not(.detail-open) .status-cockpit .worktree-summary,
  body.mobile-app:not(.detail-open) .status-cockpit .section-block {
    margin: 0;
  }

  body.mobile-app:not(.detail-open) .status-cockpit .worktree-summary {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px 14px;
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-block {
    min-width: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 6%, transparent);
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-block.section-block-target {
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--blue) 10%, transparent), transparent 58%),
      color-mix(in srgb, var(--bg-elev) 70%, transparent);
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--blue) 34%, transparent),
      inset 3px 0 0 var(--blue);
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-title {
    min-height: 24px;
    letter-spacing: 0.02em;
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-rows {
    gap: 10px;
    margin: 10px 0 0;
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-rows > .empty-state {
    margin-top: 2px;
    padding: 18px 0 2px;
    border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-rows > .session-row {
    margin: 0;
    padding: 12px 12px;
    border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg) 84%, var(--bg-elev));
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 5%, transparent);
  }

  body.mobile-app:not(.detail-open) .status-cockpit .section-rows > .session-row.selected {
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--blue) 28%, transparent),
      inset 4px 0 0 var(--blue);
  }

  .session-row,
  .result-row,
  .device-row {
    grid-template-columns: 8px minmax(0, 1fr);
    padding: 14px 18px;
  }

  .walle-row,
  .more-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px 18px;
  }

  .more-shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding-inline: 18px;
  }

  .more-hero-card,
  .more-danger-card {
    grid-column: 1 / -1;
  }

  .walle-chat-context {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    margin: 14px 18px 0;
  }

  .walle-context-actions {
    justify-content: flex-end;
  }

  .walle-chat-messages {
    padding-inline: 18px;
  }

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

  .session-row.selected,
  .result-row.selected {
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--blue) 13%, transparent), transparent 54%),
      var(--bg-elev);
    box-shadow:
      inset 0 0 0 1px color-mix(in srgb, var(--blue) 28%, transparent),
      inset 4px 0 0 var(--blue);
  }

  .row-actions {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    margin-top: 10px;
  }

  .row-action {
    min-height: 34px;
    min-width: 92px;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: auto;
    bottom: 0;
    width: var(--tablet-list-w);
    border-right: 1px solid var(--line);
    transform: none;
  }

  .status-summary {
    left: 0;
    right: auto;
    width: var(--tablet-list-w);
    border-right: 1px solid var(--line);
    transform: none;
  }

  body.mobile-app.detail-open .bottom-nav {
    display: none;
  }

  body.mobile-app:not(.detail-open) .bottom-nav {
    left: max(0px, calc((100vw - var(--tablet-single-w)) / 2));
    width: var(--tablet-single-w);
    border-left: 1px solid var(--line);
    transform: none;
  }

  body.mobile-app:not(.detail-open) .status-summary {
    left: max(0px, calc((100vw - var(--tablet-single-w)) / 2));
    width: var(--tablet-single-w);
    border-left: 1px solid var(--line);
    transform: none;
  }

  .detail-view {
    top: 0;
    left: var(--tablet-list-w);
    right: 0;
    bottom: 0;
    width: auto;
    height: 100vh;
    min-height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    border-left: 0;
    border-right: 0;
    transform: none;
    background:
      radial-gradient(circle at 16% 8%, color-mix(in srgb, var(--blue) 10%, transparent), transparent 34%),
      linear-gradient(180deg, color-mix(in srgb, var(--bg-elev) 56%, transparent), transparent 260px),
      var(--bg);
  }

  .detail-view.active {
    display: flex;
  }

  .detail-topbar {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    width: auto;
    min-height: calc(var(--tablet-topbar-h) + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) clamp(20px, 3vw, 34px) 12px;
    transform: none;
    box-shadow:
      0 18px 44px rgba(0, 0, 0, 0.16),
      inset 0 -1px 0 color-mix(in srgb, var(--blue) 10%, transparent);
  }

  .detail-back-btn {
    min-width: 96px;
    min-height: 52px;
    padding-inline: 16px 18px;
    border-radius: 16px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--blue) 20%, var(--bg-soft)), color-mix(in srgb, var(--blue) 10%, var(--bg-soft)));
  }

  .detail-back-label {
    display: inline;
  }

  .detail-alert,
  .detail-controls {
    padding-inline: clamp(20px, 3vw, 34px);
  }

  .detail-messages {
    padding: 20px clamp(20px, 3vw, 36px) 28px;
    scroll-padding-bottom: 24px;
  }

  .detail-messages .msg,
  .detail-messages .review-msg,
  .detail-messages .turn,
  .detail-messages .prompt-turn,
  .detail-messages .thought-group,
  .message-row {
    max-width: min(920px, 100%);
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 68px;
    align-items: center;
    gap: 12px;
    padding: 16px clamp(20px, 3vw, 36px) calc(18px + env(safe-area-inset-bottom));
    border-top-color: color-mix(in srgb, var(--blue) 20%, var(--line));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg) 18%, transparent), color-mix(in srgb, var(--bg-elev) 96%, transparent) 30%, var(--bg-elev)),
      var(--bg-elev);
    box-shadow:
      0 -22px 54px rgba(0, 0, 0, 0.32),
      inset 0 1px 0 color-mix(in srgb, var(--fg) 7%, transparent);
  }

  .composer.has-model-picker {
    grid-template-columns: minmax(0, 1fr) 92px 68px;
  }

  .composer-editor {
    min-height: 66px;
    max-height: min(32vh, 220px);
    padding: 18px 58px 18px 18px;
    border-radius: 20px;
    border-color: color-mix(in srgb, var(--blue) 24%, var(--line-strong));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 78%, var(--bg-elev)), var(--bg-elev));
    font-size: 15px;
    line-height: 1.42;
    box-shadow:
      inset 0 1px 0 color-mix(in srgb, var(--fg) 7%, transparent),
      0 12px 28px rgba(0, 0, 0, 0.16);
  }

  .composer-editor:focus {
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--blue) 7%, var(--bg-soft)), var(--bg-elev));
    box-shadow:
      inset 0 1px 0 color-mix(in srgb, var(--fg) 9%, transparent),
      0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent),
      0 14px 34px rgba(0, 0, 0, 0.22);
  }

  .send-btn {
    width: 68px;
    min-width: 68px;
    height: 66px;
    min-height: 66px;
    border-radius: 20px;
    border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--blue) 94%, #fff), var(--blue));
    color: #07111f;
    font-size: 20px;
    box-shadow:
      inset 0 1px 0 color-mix(in srgb, #fff 38%, transparent),
      0 14px 32px color-mix(in srgb, var(--blue) 24%, transparent),
      0 8px 20px rgba(0, 0, 0, 0.22);
  }

  .send-btn.hold-only {
    border-color: color-mix(in srgb, var(--blue) 42%, var(--line-strong));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--blue) 13%, var(--bg-soft)), color-mix(in srgb, var(--bg-elev-2) 88%, var(--blue)));
    color: var(--blue);
    box-shadow:
      inset 0 1px 0 color-mix(in srgb, var(--fg) 8%, transparent),
      0 10px 26px rgba(0, 0, 0, 0.22);
  }

  .model-picker-btn {
    width: 92px;
    min-width: 92px;
    height: 66px;
    min-height: 66px;
    border-radius: 18px;
  }

  .composer-clear {
    top: 9px;
    right: 8px;
  }

  .send-menu {
    left: calc(var(--tablet-list-w) + clamp(20px, 3vw, 36px));
    right: clamp(20px, 3vw, 36px);
    bottom: calc(var(--mobile-keyboard-offset, 0px) + env(safe-area-inset-bottom) + 104px);
    max-width: 680px;
  }

  .mobile-skill-picker {
    right: -70px;
    max-height: min(44vh, 340px);
  }

  .modal-backdrop {
    left: var(--tablet-list-w);
    justify-content: center;
  }

  .stepup-sheet,
  .model-picker-sheet {
    width: min(640px, calc(100vw - var(--tablet-list-w) - 48px));
  }
}
