:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #111111;
  --muted: #8a8a8a;
  --muted-strong: #666666;
  --chip: #f3f3f3;
  --chip-strong: #ededed;
  --line: #ececec;
  --line-strong: #dddddd;
  --green: #20b26b;
  --red: #d7443e;
  --amber: #bd7814;
  --blue: #3f6f94;
  --shadow-soft: 0 3px 14px rgb(0 0 0 / 5%);
  --shadow-float: 0 8px 28px rgb(0 0 0 / 10%);
  --radius: 8px;
  --sidebar-width: 360px;
  --ui-title-size: 24px;
  --ui-title-weight: 650;
  --ui-control-size: 40px;
  --ui-chip-height: 42px;
  --ui-chip-font-size: 14px;
  --ui-section-size: 18px;
  --ui-project-size: 16px;
  --ui-thread-size: 15px;
  --ui-action-height: 44px;
  --ui-action-font-size: 14px;
  --ui-meta-size: 11px;
  --ui-chat-title-size: 17px;
  --safe-top: env(safe-area-inset-top, 0px);
  --app-vh: 100vh;
  --log-sheet-height: calc(var(--app-vh) / 3);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

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

button,
select {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

[hidden] {
  display: none !important;
}

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

.icon-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  width: 100%;
  max-width: 100%;
  height: var(--app-vh);
  min-height: 0;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow-x: clip;
  background: var(--bg);
}

.drawer-scrim {
  display: none;
}

.home-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.home-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(16px + var(--safe-top)) 18px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.home-header {
  display: grid;
  align-items: center;
  grid-template-columns: var(--ui-control-size) minmax(0, 1fr) var(--ui-control-size);
  gap: 8px;
}

.home-header h1 {
  overflow: hidden;
  margin: 0;
  font-size: var(--ui-title-size);
  font-weight: var(--ui-title-weight);
  letter-spacing: 0;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-header #toggleAllProjects {
  visibility: hidden;
  pointer-events: none;
}

.chat-header #backHome {
  visibility: hidden;
  pointer-events: none;
}

.circle-button {
  position: relative;
  display: inline-grid;
  width: var(--ui-control-size);
  height: var(--ui-control-size);
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #454545;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.circle-button::after {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  content: "";
}

.circle-button svg {
  width: 20px;
  height: 20px;
}

.circle-button:hover,
.circle-button:focus-visible {
  border-color: var(--line-strong);
  background: #fafafa;
  outline: none;
}

.device-status {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
}

.device-status.ready {
  background: var(--green);
}

.device-status.error {
  background: var(--red);
}

.project-section {
  margin-top: 20px;
}

.project-section-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.project-section-heading h2 {
  margin: 0;
  font-size: var(--ui-section-size);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
}

.connection-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--ui-meta-size);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list {
  min-width: 0;
}

.project-group {
  min-width: 0;
  margin: 0 0 12px;
}

.project-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 2px;
}

.project-toggle {
  display: flex;
  min-width: 0;
  min-height: 40px;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.project-toggle:focus-visible,
.project-create:focus-visible,
.thread-row:focus-visible {
  border-radius: 6px;
  outline: 2px solid #111111;
  outline-offset: 1px;
}

.project-folder {
  width: 20px;
  height: 20px;
  flex: none;
  color: #111111;
}

.project-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--ui-project-size);
  font-weight: 600;
  line-height: 1.35;
}

.project-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--muted);
  transition: rotate 160ms ease;
}

.project-toggle[aria-expanded="true"] .project-chevron {
  rotate: 180deg;
}

.project-create {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #b0b0b0;
  background: transparent;
}

.project-create:hover,
.project-create:focus-visible {
  color: #111111;
  background: #f7f7f7;
  outline: none;
}

.project-create svg {
  width: 18px;
  height: 18px;
}

.project-related {
  min-width: 0;
  padding: 0 34px 2px 28px;
}

.thread-row {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  color: #161616;
  background: transparent;
  font-size: var(--ui-thread-size);
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
}

.thread-row:hover {
  color: #000000;
}

.thread-row .thread-title {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.thread-row.active .thread-title {
  font-weight: 620;
}

.thread-row.readonly {
  color: var(--muted-strong);
}

.thread-empty {
  padding: 8px 0 3px;
  color: var(--muted);
  font-size: 13px;
}

.search-empty {
  padding: 34px 0;
  color: var(--muted);
  font-size: 16px;
}

.home-actions {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) var(--ui-action-height);
  gap: 8px;
  padding: 8px 14px calc(10px + var(--safe-bottom));
  background: linear-gradient(to bottom, rgb(255 255 255 / 0%), #ffffff 20%);
}

.search-box {
  display: flex;
  min-width: 0;
  height: var(--ui-action-height);
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--chip);
}

.search-box:focus-within {
  border-color: var(--line-strong);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgb(0 0 0 / 4%);
}

.search-box svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted-strong);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: var(--ui-action-font-size);
}

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

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.chat-action {
  display: inline-flex;
  width: var(--ui-action-height);
  height: var(--ui-action-height);
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #1b1b1b;
  box-shadow: var(--shadow-soft);
}

.chat-action:hover,
.chat-action:focus-visible {
  background: #000000;
  outline: none;
}

.chat-action svg {
  width: 18px;
  height: 18px;
}

.workspace {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  background: var(--bg);
}

.chat-header {
  display: grid;
  min-width: 0;
  align-items: center;
  grid-template-columns: var(--ui-control-size) minmax(0, 1fr) var(--ui-control-size);
  gap: 8px;
  padding: calc(10px + var(--safe-top)) clamp(12px, 3vw, 24px) 9px;
  background: var(--bg);
}

.thread-heading {
  min-width: 0;
  text-align: center;
}

.thread-heading h1 {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  margin: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: var(--ui-chat-title-size);
  font-weight: var(--ui-title-weight);
  letter-spacing: 0;
  line-height: 1.25;
}

.thread-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--ui-meta-size);
}

.thread-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-divider {
  width: 3px;
  height: 3px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.run-state {
  color: var(--green);
}

.run-state.running {
  color: var(--amber);
}

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

.history-warning {
  grid-row: 2;
  margin: 5px clamp(16px, 4vw, 36px) 0;
  padding: 9px 11px;
  border: 1px solid #f0dfbe;
  border-radius: var(--radius);
  color: var(--amber);
  background: #fffaf0;
  font-size: 12px;
}

.transcript {
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px clamp(16px, 4vw, 42px) 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.transcript.dragging {
  scroll-behavior: auto;
}

.timeline {
  width: min(100%, 860px);
  min-width: 0;
  margin: 0 auto;
}

.history-load-more {
  display: block;
  min-width: 132px;
  min-height: 36px;
  margin: 0 auto 24px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted-strong);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.history-load-more:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
}

.history-load-more:disabled {
  cursor: wait;
  opacity: 0.6;
}

.empty-state {
  display: flex;
  width: min(100%, 520px);
  min-height: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #777777;
  background: #ffffff;
}

.empty-icon svg {
  width: 23px;
  height: 23px;
}

.empty-state h2 {
  margin: 13px 0 0;
  color: var(--muted-strong);
  font-size: 16px;
  font-weight: 520;
  letter-spacing: 0;
}

.empty-state.is-loading .empty-icon {
  animation: empty-state-pulse 1.2s ease-in-out infinite;
}

@keyframes empty-state-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .empty-state.is-loading .empty-icon {
    animation: none;
  }
}

.message {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  margin: 0 0 26px;
}

.message.user {
  justify-content: flex-end;
}

.message-body {
  min-width: 0;
  max-width: min(82%, 690px);
}

.message-text {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.75;
  white-space: normal;
  word-break: break-word;
}

.message.user .message-text {
  padding: 10px 14px;
  border-radius: 8px;
  background: #f3f3f3;
  line-height: 1.55;
}

.message.agent .message-text {
  color: #121212;
  background: transparent;
}

.message-actions {
  display: flex;
  margin-top: 2px;
}

.message.user .message-actions {
  justify-content: flex-end;
}

.message-copy-button {
  display: inline-flex;
  min-width: 28px;
  height: 26px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  color: #8a8a8a;
  background: transparent;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease;
}

.message:hover .message-copy-button,
.message-copy-button:focus-visible,
.message-copy-button.copied {
  opacity: 1;
}

.message-copy-button:hover {
  color: #111111;
  background: #ededed;
}

.message-copy-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-copy-button.copied {
  color: #23653b;
}

.message-copy-label {
  white-space: nowrap;
}

@media (hover: none) {
  .message-copy-button {
    opacity: 1;
  }
}

.message-text a {
  color: #1d5f8f;
  text-underline-offset: 2px;
}

.message-text a.markdown-file-reference {
  cursor: pointer;
}

.message-text a.markdown-file-reference:hover,
.message-text a.markdown-file-reference:focus-visible {
  color: #111111;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.message-text a:not([href]) {
  color: inherit;
  text-decoration: none;
}

.file-change-path {
  border-radius: 4px;
  transition:
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.file-change-path.is-highlighted {
  background: #fff5d9;
  box-shadow: 0 0 0 4px #fff5d9;
}

.file-change-path:focus-visible {
  outline: 2px solid #bd7814;
  outline-offset: 3px;
}

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

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0.55em 0 0.7em;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1em 0 0.4em;
  color: #121212;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0;
}

.markdown-body h1 {
  font-size: 1.35em;
}

.markdown-body h2 {
  font-size: 1.24em;
}

.markdown-body h3 {
  font-size: 1.14em;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 1em;
}

.markdown-body strong {
  font-weight: 650;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.5em 0 0.75em;
  padding-left: 1.45em;
}

.markdown-body li {
  padding-left: 0.1em;
}

.markdown-body li + li {
  margin-top: 0.22em;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin-top: 0.22em;
  margin-bottom: 0.22em;
}

.markdown-body .contains-task-list {
  padding-left: 0;
  list-style: none;
}

.markdown-body ul:has(> .task-list-item),
.markdown-body ul:has(> li > input[type="checkbox"]) {
  padding-left: 0;
  list-style: none;
}

.markdown-body .task-list-item,
.markdown-body li:has(> input[type="checkbox"]) {
  display: flex;
  gap: 0.5em;
  align-items: flex-start;
  padding-left: 0;
  list-style: none;
}

.markdown-body .task-list-item input,
.markdown-body li > input[type="checkbox"] {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0.38em 0 0;
  accent-color: #111111;
}

.markdown-body blockquote {
  margin: 0.65em 0;
  padding: 0.1em 0 0.1em 0.9em;
  border-left: 2px solid #d5d5d5;
  color: #5f5f5f;
}

.markdown-body blockquote > :first-child {
  margin-top: 0;
}

.markdown-body blockquote > :last-child {
  margin-bottom: 0;
}

.markdown-body :not(pre) > code {
  padding: 0.12em 0.34em;
  border-radius: 4px;
  background: #f2f2f2;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.86em;
}

.markdown-body hr {
  margin: 1em 0;
  border: 0;
  border-top: 1px solid #e4e4e4;
}

.markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 0.7em 0 0.85em;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}

.markdown-body table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
  line-height: 1.45;
}

.markdown-body th,
.markdown-body td {
  padding: 6px 9px;
  border-right: 1px solid #eeeeee;
  border-bottom: 1px solid #eeeeee;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  color: #3c3c3c;
  background: #f7f7f7;
  font-weight: 600;
}

.markdown-body tr:last-child td {
  border-bottom: 0;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.markdown-code-block {
  max-width: 100%;
  overflow: hidden;
  margin: 0.7em 0 0.85em;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  background: #f8f8f8;
}

.markdown-code-header {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 5px 2px 10px;
  border-bottom: 1px solid #e7e7e7;
  color: #747474;
}

.markdown-code-language {
  overflow: hidden;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.markdown-copy-button {
  display: inline-flex;
  min-width: 28px;
  height: 26px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  color: #666666;
  background: transparent;
  font-size: 11px;
  line-height: 1;
}

.markdown-copy-button:hover,
.markdown-copy-button:focus-visible {
  color: #111111;
  background: #ededed;
}

.markdown-copy-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.markdown-copy-button.copied {
  color: #23653b;
}

.markdown-code-block pre {
  max-width: 100%;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 10px 12px;
  background: #fbfbfb;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
}

.markdown-code-block code {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  white-space: inherit;
}

.markdown-fallback {
  white-space: pre-wrap;
}

.stream-cursor::after {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  translate: 0 2px;
  background: #111111;
  content: "";
  animation: pulse 0.9s ease-in-out infinite;
}

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

.progress-item {
  min-width: 0;
  margin: 0 0 4px;
  border: 0;
  background: transparent;
}

.progress-item summary,
.process-group > summary {
  display: flex;
  min-height: 32px;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 5px 2px;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.progress-item summary::-webkit-details-marker,
.process-group > summary::-webkit-details-marker {
  display: none;
}

.progress-item summary:focus-visible,
.process-group > summary:focus-visible {
  border-radius: 4px;
  outline: 1px solid #b7b7b7;
  outline-offset: 1px;
}

.summary-icon {
  display: grid;
  width: 17px;
  height: 17px;
  flex: none;
  place-items: center;
  color: #777777;
  background: transparent;
}

.progress-item.command .summary-icon,
.process-group.command > summary .summary-icon {
  color: #5f7167;
}

.progress-item.file .summary-icon,
.process-group.file > summary .summary-icon {
  color: #8c7554;
}

.progress-item.error .summary-icon {
  color: var(--red);
}

.summary-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.7;
}

.summary-label {
  flex: none;
  color: #4e4e4e;
  font-size: 13px;
  font-weight: 500;
}

.summary-detail {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #969696;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-state {
  flex: none;
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

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

.progress-state.running {
  width: 6px;
  height: 6px;
  overflow: hidden;
  border-radius: 50%;
  color: transparent;
  background: var(--amber);
  font-size: 0;
  animation: progress-pulse 1.15s ease-in-out infinite;
}

@keyframes progress-pulse {
  50% {
    opacity: 0.28;
  }
}

.progress-chevron {
  display: grid;
  width: 14px;
  height: 14px;
  flex: none;
  place-items: center;
  color: #aaaaaa;
  transition: rotate 140ms ease;
}

.progress-chevron svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.8;
}

.progress-item[open] > summary .progress-chevron,
.process-group[open] > summary .progress-chevron {
  rotate: 180deg;
}

.process-group {
  min-width: 0;
  margin: 0 0 4px;
  border: 0;
  background: transparent;
}

.process-group-count {
  flex: none;
  color: #8d8d8d;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.process-group-pulse {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
  animation: progress-pulse 1.15s ease-in-out infinite;
}

.process-group-content {
  min-width: 0;
  margin: 0 0 4px 20px;
  padding: 2px 0 3px 9px;
  border-left: 1px solid #ececec;
  background: #fbfbfb;
}

.process-group:not([open]) > .process-group-content {
  display: none;
}

.process-group-content .progress-item {
  margin-bottom: 0;
}

.process-group-content .progress-item summary {
  min-height: 28px;
  gap: 6px;
  padding: 3px 2px;
  font-size: 12px;
}

.process-group-content .summary-icon {
  width: 15px;
  height: 15px;
}

.process-group-content .summary-icon svg {
  width: 15px;
  height: 15px;
}

.process-group-content .summary-label {
  font-size: 12px;
}

.process-group-content .summary-detail {
  font-size: 12px;
}

.process-group-content .progress-chevron,
.process-group-content .progress-chevron svg {
  width: 12px;
  height: 12px;
}

.process-group-content .progress-content {
  margin-left: 21px;
}

.progress-content {
  min-width: 0;
  margin: 0 0 3px 24px;
  padding: 5px 8px 7px 10px;
  border-left: 1px solid #e7e7e7;
  background: #fafafa;
}

.progress-item:not([open]) > .progress-content {
  display: none;
}

.code-block {
  max-width: 100%;
  max-height: 300px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #272727;
  background: #fafafa;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: normal;
  tab-size: 2;
  white-space: pre;
}

.reasoning-grid {
  display: grid;
  gap: 6px;
}

.reasoning-block h4 {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.reasoning-block .code-block {
  max-height: 220px;
  color: var(--muted-strong);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.progress-content .code-block {
  max-height: 260px;
  padding: 4px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1.5;
}

.progress-content .subtle-meta {
  margin: 0 0 2px;
  font-size: 10px;
  line-height: 1.4;
}

.subtle-meta {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
}

.approval-dock {
  grid-row: 4;
  width: min(calc(100% - clamp(32px, 8vw, 84px)), 860px);
  max-height: min(calc(var(--app-vh) * 0.42), 430px);
  overflow-y: auto;
  margin: 0 auto 8px;
}

.approval-card {
  padding: 13px;
  border: 1px solid #dedede;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 8px 30px rgb(0 0 0 / 8%);
}

.approval-card + .approval-card {
  margin-top: 8px;
}

.approval-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.approval-heading svg {
  width: 17px;
  height: 17px;
  flex: none;
  color: #111111;
}

.approval-heading strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-kicker {
  flex: none;
  color: var(--muted);
  font-size: 10px;
}

.approval-detail {
  max-height: 120px;
  overflow: auto;
  margin: 7px 0 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #242424;
  background: #fafafa;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.approval-actions button,
.question-submit {
  min-height: 36px;
  flex: 1 1 120px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
}

.approval-actions button:hover,
.approval-actions button:focus-visible,
.question-submit:hover,
.question-submit:focus-visible {
  border-color: #111111;
  outline: none;
}

.approval-actions .allow,
.question-submit {
  border-color: #111111;
  color: #ffffff;
  background: #111111;
}

.approval-actions .danger {
  color: var(--red);
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-block {
  min-width: 0;
}

.question-header {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.question-text {
  margin: 2px 0 7px;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 600;
}

.question-options {
  display: grid;
  gap: 5px;
}

.question-option {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
}

.question-option input {
  width: 15px;
  height: 15px;
  flex: none;
  margin: 2px 0 0;
  accent-color: #111111;
}

.question-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.question-option small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.question-input {
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
}

.question-submit {
  width: 100%;
  margin-top: 9px;
}

.composer {
  grid-row: 5;
  position: relative;
  padding: 8px clamp(16px, 4vw, 42px) calc(11px + var(--safe-bottom));
  border-top: 1px solid rgb(236 236 236 / 75%);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(14px);
}

.composer-box {
  display: flex;
  width: min(100%, 860px);
  min-width: 0;
  align-items: flex-end;
  gap: 8px;
  margin: 0 auto;
  padding: 7px 7px 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #ffffff;
}

.composer-box:focus-within {
  border-color: #bdbdbd;
}

.composer textarea {
  width: 100%;
  min-width: 0;
  max-height: 132px;
  overflow-y: auto;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: var(--muted);
}

.send-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #111111;
}

.send-button:hover,
.send-button:focus-visible {
  background: #333333;
  outline: 2px solid var(--chip-strong);
}

.send-button:disabled {
  color: #999999;
  background: var(--chip-strong);
}

.send-button .stop-icon {
  display: none;
}

.send-button.is-running {
  background: var(--red);
}

.send-button.is-running .send-icon {
  display: none;
}

.send-button.is-running .stop-icon {
  display: block;
}

.composer-hint {
  display: flex;
  width: min(100%, 860px);
  min-height: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px auto 0;
  color: var(--muted);
  font-size: 9px;
}

.usage-chip {
  overflow: hidden;
  margin-left: auto;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readonly-banner {
  width: min(100%, 860px);
  margin: 0 auto 7px;
  color: var(--amber);
  font-size: 11px;
}

.sheet-layer {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: rgb(0 0 0 / 28%);
}

.settings-sheet {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 430px);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -12px 0 40px rgb(0 0 0 / 10%);
  animation: sheet-in 180ms ease-out;
}

@keyframes sheet-in {
  from {
    translate: 18px 0;
    opacity: 0;
  }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + var(--safe-top)) 20px 14px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
}

.settings-content {
  min-height: 0;
  overflow-y: auto;
  padding: 0 20px calc(24px + var(--safe-bottom));
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafafa;
}

.connection-card > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.connection-card strong {
  font-size: 13px;
  font-weight: 600;
}

.connection-card span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-device-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.settings-device-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #111111;
  background: #fafafa;
}

.settings-device-mark svg {
  width: 20px;
  height: 20px;
}

.settings-device-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.settings-device-copy > span:first-child {
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
}

.settings-device-copy strong,
.settings-device-copy > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-device-copy strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.settings-device-copy > span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.remote-notification-card {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.remote-notification-card[hidden] {
  display: none;
}

.remote-notification-copy {
  display: grid;
  min-width: 0;
  min-height: 88px;
  align-content: center;
  gap: 2px;
}

.remote-notification-copy h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.remote-notification-copy p {
  min-height: 2.8em;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.remote-notification-copy .remote-notification-hint {
  min-height: 0;
  color: var(--amber);
}

.remote-notification-toggle {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 1px solid #cfcfcf;
  border-radius: 999px;
  background: #e9e9e9;
}

.remote-notification-toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
  transition: translate 160ms ease;
}

.remote-notification-toggle[aria-checked="true"] {
  border-color: #111111;
  background: #111111;
}

.remote-notification-toggle[aria-checked="true"] span {
  translate: 18px 0;
}

.remote-notification-toggle:focus-visible {
  outline: 2px solid var(--chip-strong);
  outline-offset: 2px;
}

.remote-notification-toggle:disabled {
  cursor: default;
  opacity: 0.55;
}

.composer-toolbar {
  display: flex;
  width: min(100%, 860px);
  min-width: 0;
  align-items: center;
  gap: 6px;
  margin: 7px auto 0;
}

.composer-control {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
}

.composer-control-button {
  display: inline-flex;
  max-width: 100%;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: #ffffff;
  font-size: 11px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
}

.composer-control-button::after {
  width: 5px;
  height: 5px;
  flex: none;
  border-right: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  content: "";
  rotate: 45deg;
  translate: 0 -1px;
}

.composer-control-button > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-control-button:hover:not(:disabled),
.composer-control-button:focus-visible,
.composer-control-button[aria-expanded="true"] {
  border-color: #c9c9c9;
  color: var(--fg);
  outline: none;
}

.composer-control-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.composer-menu {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 0;
  right: auto;
  z-index: 40;
  display: grid;
  min-width: 148px;
  max-width: min(260px, calc(100vw - 32px));
  max-height: min(320px, calc(var(--app-vh) - 140px));
  gap: 2px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgb(0 0 0 / 16%);
}

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

.composer-menu button {
  min-width: 0;
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  color: var(--muted-strong);
  background: transparent;
  font-size: 12px;
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-menu button[aria-pressed="true"] {
  color: var(--fg);
  background: #f2f2f1;
  font-weight: 650;
}

.composer-menu button:hover:not(:disabled),
.composer-menu button:focus-visible {
  background: #f7f7f6;
  outline: none;
}

.composer-menu button:disabled {
  cursor: default;
  opacity: 0.5;
}

.composer-menu .permission-mode-error {
  margin: 2px 0 0;
  padding: 0 9px 4px;
  color: var(--red);
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
}

.connection-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
}

.connection-dot.ready {
  background: var(--green);
}

.connection-dot.connecting,
.connection-dot.restarting {
  background: var(--amber);
  animation: pulse 1.2s ease-in-out infinite;
}

.connection-dot.error {
  background: var(--red);
}

.auth-mode-note {
  width: fit-content;
  margin-top: 10px;
  padding: 5px 8px;
  border: 1px solid #e5dfcf;
  border-radius: 6px;
  color: #766a4f;
  background: #fbf8ef;
  font-size: 11px;
}

.account-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.account-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
}

.account-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.account-icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.account-icon-button:hover,
.account-icon-button:focus-visible {
  background: #f7f7f7;
  outline: none;
}

.account-icon-button svg {
  width: 15px;
  height: 15px;
}

.account-form {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.account-form label {
  display: grid;
  gap: 4px;
}

.account-form label > span {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 550;
}

.account-form input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  font-size: 12px;
}

.account-form input:focus {
  border-color: #111111;
}

.account-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 2px;
}

.account-auth-actions button,
.account-device-action,
.account-logout {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  font-size: 11px;
  font-weight: 550;
}

.account-auth-actions button:first-child {
  border-color: #111111;
  color: #ffffff;
  background: #111111;
}

.account-auth-actions button:hover,
.account-auth-actions button:focus-visible,
.account-device-action:hover,
.account-device-action:focus-visible,
.account-logout:hover,
.account-logout:focus-visible {
  outline: none;
  filter: brightness(0.97);
}

.account-current {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafafa;
}

.account-current > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.account-current strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-signal {
  color: var(--muted);
  font-size: 10px;
}

.account-signal.online {
  color: var(--green);
}

.account-remote-state {
  flex: none;
  color: var(--muted);
  font-size: 10px;
}

.account-remote-state.connected {
  color: var(--green);
}

.account-remote-state.connecting {
  color: var(--amber);
}

.account-remote-state.failed,
.account-remote-state.disconnected {
  color: var(--red);
}

.account-devices {
  display: grid;
  max-height: 172px;
  gap: 5px;
  margin-top: 8px;
  overflow-y: auto;
}

.account-device {
  display: grid;
  min-width: 0;
  min-height: 42px;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 7px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.account-device-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8c8c8;
}

.account-device-dot.online {
  background: var(--green);
}

.account-device-dot.connecting {
  background: var(--amber);
}

.account-device-dot.failed {
  background: var(--red);
}

.account-device-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.account-device-copy strong,
.account-device-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-device-copy strong {
  font-size: 11px;
  font-weight: 600;
}

.account-device-copy span {
  color: var(--muted);
  font-size: 9px;
}

.account-device-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
}

.account-device-action {
  min-width: 48px;
  min-height: 27px;
  padding: 0 8px;
}

.account-device-delete {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid #efdad8;
  border-radius: 7px;
  color: var(--red);
  background: #fffafa;
}

.account-device-delete:hover,
.account-device-delete:focus-visible {
  border-color: #e3bbb7;
  background: #fff3f2;
  outline: none;
}

.account-device-delete svg {
  width: 15px;
  height: 15px;
}

.account-device-empty {
  padding: 12px 8px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.account-logout {
  width: 100%;
  margin-top: 8px;
  color: var(--red);
  border-color: #f0d5d3;
  background: #fffafa;
}

.account-error {
  margin: 8px 0 0;
  color: var(--red);
  font-size: 10px;
}

.speed-test-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.speed-test-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.speed-test-copy {
  min-width: 0;
}

.speed-test-copy h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
}

.speed-test-copy p {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-test-button {
  display: inline-flex;
  min-height: 32px;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 550;
}

.speed-test-button:hover,
.speed-test-button:focus-visible {
  background: #f7f7f7;
  outline: none;
}

.speed-test-button svg {
  width: 14px;
  height: 14px;
}

.speed-test-button:disabled svg {
  animation: speed-spin 900ms linear infinite;
}

@keyframes speed-spin {
  to {
    rotate: 360deg;
  }
}

.speed-test-metrics {
  display: grid;
  margin-top: 11px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.speed-test-metric {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding: 7px 4px 6px;
  background: #fafafa;
  text-align: center;
}

.speed-test-metric + .speed-test-metric {
  border-left: 1px solid var(--line);
}

.speed-test-metric strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-test-metric span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-test-foot {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.speed-test-foot span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-test-error {
  margin: 7px 0 0;
  color: var(--red);
  font-size: 11px;
}

.setting-label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 550;
}

.about-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-row {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.detail-row code {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-log-block {
  margin-top: 20px;
}

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

.connection-log-actions {
  display: flex;
  gap: 6px;
}

.connection-log-actions button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--fg);
  font-size: 11px;
}

.connection-log {
  max-height: 240px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f7f9;
  color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.settings-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--fg);
  font-size: 13px;
  text-align: left;
}

.settings-log-hint {
  color: var(--muted);
  font-size: 11px;
}

.log-sheet-layer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}

.log-sheet-layer[hidden] {
  display: none;
}

body.log-terminal-open .app-shell,
body.log-terminal-open .home-panel,
body.log-terminal-open .workspace {
  height: calc(var(--app-vh) - var(--log-sheet-height));
}

body.log-terminal-open .home-panel {
  bottom: auto;
}

.log-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--log-sheet-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid #262b33;
  border-radius: 14px 14px 0 0;
  background: #0f1115;
  color: #d1d5db;
  box-shadow: 0 -12px 32px rgba(15, 17, 21, 0.28);
}

.log-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #262b33;
}

.log-sheet-head h2 {
  flex: 1;
  margin: 0;
  color: #f3f4f6;
  font-size: 13px;
  font-weight: 600;
}

.log-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.log-sheet-actions {
  display: flex;
  gap: 6px;
}

.log-sheet-actions button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid #343a44;
  border-radius: 6px;
  background: #171a20;
  color: #e5e7eb;
  font-size: 11px;
}

.log-terminal {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 10px 14px 16px;
  overflow: auto;
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.logout-button {
  width: 100%;
  margin-top: 24px;
  padding: 11px 12px;
  border: 1px solid #f0d5d3;
  border-radius: var(--radius);
  color: var(--red);
  background: #fffafa;
  font-size: 13px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: calc(12px + var(--safe-top));
  left: 50%;
  display: grid;
  width: min(calc(100vw - 28px), 420px);
  gap: 7px;
  translate: -50% 0;
  pointer-events: none;
}

.toast {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-float);
  font-size: 12px;
  text-align: center;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  border-color: #efcfcd;
  color: var(--red);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

.auth-gate {
  display: grid;
  height: var(--app-vh);
  place-items: center;
  padding: 24px;
  background: #ffffff;
}

.auth-panel {
  width: min(100%, 360px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.auth-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #111111;
  background: var(--chip);
}

.auth-panel h1 {
  margin: 16px 0 3px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0;
}

.auth-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

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

.auth-panel input {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: #ffffff;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
}

.auth-panel input:focus {
  border-color: #111111;
}

.primary-button {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  background: #111111;
  font-size: 13px;
  font-weight: 600;
}

.primary-button:disabled {
  opacity: 0.6;
}

.secondary-button {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.entry-screen {
  display: grid;
  height: var(--app-vh);
  min-height: 0;
  place-items: center;
  padding: 24px;
  background: #ffffff;
}

.entry-screen-scroll {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  overflow-y: auto;
  padding: max(18px, var(--safe-top)) 20px max(20px, var(--safe-bottom));
}

.entry-card {
  width: min(100%, 360px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.entry-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #111111;
  background: var(--chip);
}

.entry-card h1 {
  margin: 16px 0 3px;
  font-size: 20px;
  font-weight: 650;
}

.entry-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.entry-card .field-label {
  margin-top: 10px;
}

.entry-card input {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  background: #ffffff;
  font-size: 14px;
}

.entry-card input:focus {
  border-color: #111111;
}

.entry-actions {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.entry-error {
  margin: 12px 0 0;
  color: var(--red);
  font-size: 12px;
}

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.entry-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}

.entry-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.entry-header-actions {
  display: flex;
  gap: 8px;
}

.device-list {
  display: grid;
  gap: 10px;
}

.device-card {
  display: grid;
  align-items: center;
  gap: 12px;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.device-card.last-used {
  border-color: #111111;
}

.device-lastused-tag {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 6px;
  color: #111111;
  background: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
}

.device-card.offline {
  opacity: 0.62;
}

.device-card.connecting {
  border-color: #9bb4cc;
}

.device-card.failed {
  border-color: #e3b4b4;
}

.device-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.device-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.device-title-row strong {
  min-width: 0;
  flex: none;
  max-width: 100%;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-copy span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.device-card.failed .device-actions {
  max-width: 160px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.device-copy .device-error {
  color: #b42318;
  white-space: normal;
  line-height: 1.45;
}

.device-connect {
  padding: 9px 16px;
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  background: #111111;
  font-size: 13px;
  font-weight: 600;
}

.device-cancel {
  border: 1px solid var(--line-strong);
  color: var(--fg);
  background: #ffffff;
}

.device-diag {
  margin-right: 2px;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  background: #ffffff;
}

.device-card.deleting {
  border-color: #e3b4b4;
}

.device-delete-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid #efdad8;
  border-radius: 7px;
  color: var(--red);
  background: #fffafa;
}

.device-delete-button:hover,
.device-delete-button:focus-visible {
  border-color: #e3bbb7;
  background: #fff3f2;
  outline: none;
}

.device-delete-button svg {
  width: 17px;
  height: 17px;
}

.device-state {
  padding: 9px 14px;
  color: var(--muted);
  font-size: 12px;
}

.device-empty {
  padding: 26px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.device-empty .device-empty-refresh {
  margin-top: 14px;
  padding: 9px 18px;
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  background: #111111;
  font-size: 13px;
  font-weight: 600;
}

.device-delete-dialog {
  width: min(calc(100vw - 32px), 420px);
  max-width: none;
  max-height: calc(var(--app-vh) - var(--safe-top) - var(--safe-bottom) - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 18px 60px rgb(0 0 0 / 20%);
}

.device-delete-dialog::backdrop {
  background: rgb(0 0 0 / 42%);
}

.device-delete-content {
  padding: 22px 20px max(20px, calc(12px + var(--safe-bottom)));
}

.device-delete-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #efdad8;
  border-radius: 50%;
  color: var(--red);
  background: #fff7f6;
}

.device-delete-mark svg {
  width: 18px;
  height: 18px;
}

.device-delete-dialog h2 {
  margin: 14px 0 6px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.device-delete-dialog p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.6;
}

.device-delete-dialog .device-delete-status {
  margin-top: 10px;
  color: var(--red);
  font-size: 12px;
}

.device-delete-actions {
  display: grid;
  margin-top: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}

.device-delete-actions button {
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
}

.device-delete-cancel {
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.device-delete-confirm {
  border: 1px solid #b9312c;
  color: #ffffff;
  background: #c53b35;
}

.device-delete-cancel:hover,
.device-delete-cancel:focus-visible {
  border-color: #c9c9c9;
  background: #f7f7f7;
  outline: none;
}

.device-delete-confirm:hover,
.device-delete-confirm:focus-visible {
  background: #b9312c;
  outline: none;
}

.device-delete-confirm:disabled {
  color: #ffffff;
  background: #c98e8a;
  opacity: 1;
}

.permission-mode-dialog {
  width: min(calc(100vw - 32px), 420px);
  max-width: none;
  max-height: calc(var(--app-vh) - var(--safe-top) - var(--safe-bottom) - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 18px 60px rgb(0 0 0 / 20%);
}

.permission-mode-dialog::backdrop {
  background: rgb(0 0 0 / 42%);
}

.permission-mode-dialog-content {
  padding: 22px 20px max(20px, calc(12px + var(--safe-bottom)));
}

.permission-mode-dialog-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #efdad8;
  border-radius: 50%;
  color: var(--red);
  background: #fff7f6;
}

.permission-mode-dialog-mark svg {
  width: 18px;
  height: 18px;
}

.permission-mode-dialog h2 {
  margin: 14px 0 6px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.35;
}

.permission-mode-dialog p {
  margin: 0;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.6;
}

.permission-mode-dialog-actions {
  display: grid;
  margin-top: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
}

.permission-mode-dialog-actions button {
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
}

.permission-mode-dialog-cancel {
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.permission-mode-dialog-confirm {
  border: 1px solid #b9312c;
  color: #ffffff;
  background: #c53b35;
}

.permission-mode-dialog-cancel:hover,
.permission-mode-dialog-cancel:focus-visible {
  border-color: #c9c9c9;
  background: #f7f7f7;
  outline: none;
}

.permission-mode-dialog-confirm:hover,
.permission-mode-dialog-confirm:focus-visible {
  background: #b9312c;
  outline: none;
}

.current-device {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.current-device-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.current-device-copy strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-device-copy span {
  color: var(--muted);
  font-size: 11px;
}

.current-device .device-connect {
  flex-shrink: 0;
  padding: 7px 13px;
  font-size: 12px;
}

.reconnect-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 16px;
  padding: 10px 14px;
  border: 1px solid #f0c36d;
  border-radius: 8px;
  background: #fff8e6;
}

.reconnect-text {
  min-width: 150px;
  flex: 1;
  color: #8a6100;
  font-size: 13px;
  font-weight: 600;
}

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

.reconnect-action {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #d9b45a;
  border-radius: 6px;
  color: #8a6100;
  background: transparent;
  font-size: 12px;
}

.reconnect-primary {
  color: #ffffff;
  background: #8a6100;
}

.reconnect-action:disabled {
  cursor: default;
  opacity: 0.58;
}

@media (min-width: 761px) {
  .home-scroll {
    padding-right: 20px;
    padding-left: 20px;
  }

  .home-actions {
    padding-right: 20px;
    padding-left: 20px;
  }

  .message-text {
    font-size: 16px;
  }

  .transcript {
    padding-top: 26px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .home-panel {
    position: fixed;
    z-index: 71;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(82vw, 320px);
    height: var(--app-vh);
    min-height: 0;
    border-right: 1px solid var(--line);
    box-shadow: 18px 0 42px rgb(0 0 0 / 14%);
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(-100% - 12px));
    visibility: hidden;
    transition:
      transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 160ms ease,
      visibility 0s linear 220ms;
    will-change: transform, opacity;
  }

  .app-shell.sidebar-open .home-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s;
  }

  .drawer-scrim {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    padding: 0;
    border: 0;
    opacity: 0;
    background: rgb(0 0 0 / 26%);
    pointer-events: none;
    visibility: hidden;
    transition:
      opacity 160ms ease,
      visibility 0s linear 160ms;
  }

  .app-shell.sidebar-open .drawer-scrim {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition-delay: 0s;
  }

  .workspace {
    display: grid;
    width: 100%;
    max-width: 100%;
    height: var(--app-vh);
    overflow-x: clip;
  }

  .app-shell.sidebar-open .home-header #toggleAllProjects {
    visibility: visible;
    pointer-events: auto;
  }

  .chat-header #backHome {
    visibility: visible;
    pointer-events: auto;
  }

  .home-scroll {
    padding-top: calc(12px + var(--safe-top));
    padding-right: 16px;
    padding-left: 16px;
  }

  .home-actions {
    padding-right: 14px;
    padding-left: 14px;
  }

  .chat-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .transcript {
    padding-right: 16px;
    padding-left: 16px;
  }

  .message-body {
    max-width: 88%;
  }

  .message-text {
    font-size: 17px;
  }

  .approval-dock {
    width: calc(100% - 24px);
    max-height: calc(var(--app-vh) * 0.38);
  }

  .composer {
    padding-right: 11px;
    padding-left: 11px;
  }

  .settings-sheet {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(calc(var(--app-vh) * 0.88), 780px);
    grid-template-rows: auto minmax(0, 1fr);
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 16px 16px 0 0;
    animation-name: sheet-up;
  }

  @keyframes sheet-up {
    from {
      translate: 0 18px;
      opacity: 0;
    }
  }
}

@media (max-width: 380px) {
  .home-scroll {
    padding-right: 14px;
    padding-left: 14px;
  }

  .home-actions {
    gap: 7px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .search-box {
    padding: 0 12px;
  }

  .approval-actions button {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
