/*
 * ChatGPT mobile presentation for the Codex bridge.
 *
 * Layout and component behavior follow patterns from assistant-ui
 * (MIT, Copyright 2026 AgentbaseAI Inc.): a compact app bar, searchable
 * thread list, quiet process rows, a readable thread viewport, and a
 * bottom-anchored composer with attachment and send controls.
 */

:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --page: #ffffff;
  --surface: #f4f4f4;
  --surface-strong: #ececec;
  --raised: #ffffff;
  --text: #0d0d0d;
  --muted: #6f6f6f;
  --muted-strong: #515151;
  --line: rgba(13, 13, 13, 0.1);
  --line-strong: rgba(13, 13, 13, 0.16);
  --user: #f4f4f4;
  --code: #f7f7f8;
  --accent: #0d0d0d;
  --accent-ink: #ffffff;
  --green: #10a37f;
  --blue: #3b82f6;
  --danger: #c2413b;
  --soft: rgba(13, 13, 13, 0.05);
  --gpt-ink: #0d0d0d;
  --gpt-ink-opposite: #ffffff;
  --gpt-green: #10a37f;
  --gpt-blue: #3b82f6;
  --composer-radius: 28px;
  --header-height: 60px;
  --touch-target: 40px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #212121;
  --surface: #303030;
  --surface-strong: #3a3a3a;
  --raised: #2f2f2f;
  --text: #f3f3f3;
  --muted: #a9a9a9;
  --muted-strong: #c8c8c8;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --user: #303030;
  --code: #171717;
  --accent: #ffffff;
  --accent-ink: #111111;
  --soft: rgba(255, 255, 255, 0.06);
  --gpt-ink: #ffffff;
  --gpt-ink-opposite: #111111;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font-optical-sizing: auto;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea,
select {
  letter-spacing: 0;
}

button,
[role="button"] {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in srgb, var(--green) 24%, transparent);
}

.app {
  width: 100%;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  background: var(--page);
}

.phone-header {
  display: flex;
  min-height: calc(56px + env(safe-area-inset-top));
  padding:
    max(8px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    8px
    max(14px, env(safe-area-inset-left));
  align-items: center;
  border-bottom: 0;
  background: var(--page);
}

.phone-header .wordmark {
  gap: 9px;
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
}

.phone-header .mark {
  width: 29px;
  height: 29px;
  border-radius: 8px;
}

.phone-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.appearance-button,
.chat-more-button,
.icon-button {
  display: inline-grid;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 21px;
  line-height: 1;
}

.appearance-button:hover,
.chat-more-button:hover,
.icon-button:hover {
  background: var(--surface);
}

.phone-language select {
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

/* Login */

.login {
  min-height: 0;
  padding:
    max(20px, env(safe-area-inset-top)) 24px
    max(28px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--page);
}

.login-card {
  width: 100%;
  max-width: 390px;
  margin: auto;
  padding: 0;
  text-align: center;
}

.login-chatgpt-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 22px;
}

.login-chatgpt-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 15px;
}

.login h1 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: clamp(27px, 8vw, 32px);
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: 0;
}

.login .muted {
  max-width: 330px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.login form {
  margin-top: 28px;
  padding: 0;
  text-align: left;
}

.login label {
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
}

.login input:not([type="checkbox"]) {
  min-height: 50px;
  margin-top: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}

.login .remember-login {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.remember-login input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--gpt-green);
}

html body #login-button {
  height: 50px;
  margin-top: 22px;
  border-radius: 999px;
  background: var(--gpt-ink) !important;
  color: var(--gpt-ink-opposite) !important;
  font-weight: 650;
}

.login-foot {
  max-width: 340px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.bootstrap-status {
  background: var(--page);
}

.bootstrap-status .login-card {
  padding: 30px 0;
}

/* Home and thread list */

.gateway-authenticated > .phone-header {
  display: none;
}

#sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
}

.list-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: calc(var(--header-height) + env(safe-area-inset-top));
  margin: 0;
  padding:
    max(8px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    6px
    max(16px, env(safe-area-inset-left));
  align-items: center;
  gap: 10px;
  border: 0;
}

.list-heading h2 {
  display: flex;
  min-width: 0;
  margin: 0;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 23px;
  font-weight: 650;
  line-height: 1.15;
}

.list-heading h2::before {
  content: "";
  width: 29px;
  height: 29px;
  flex: none;
  border-radius: 8px;
  background: url("/icon-ui.png?v=6d10ba17cc4e1645def3c0fed1358725e78eff587b1cf62833cf4a87f0092092") center / contain no-repeat;
}

.list-heading h2 span {
  display: none;
}

.list-heading h2::after {
  content: "ChatGPT";
}

#connected-computer,
#refresh {
  display: none !important;
}

.list-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

#new-chat {
  display: inline-grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  background: var(--gpt-ink);
  color: var(--gpt-ink-opposite);
}

#new-chat:hover {
  background: color-mix(in srgb, var(--gpt-ink) 88%, var(--page));
}

#new-chat span {
  display: none;
}

#new-chat svg {
  width: 20px;
  height: 20px;
}

.list-actions .appearance-button {
  display: none;
}

.chat-list-toolbar {
  display: block;
  flex: none;
  margin: 0;
  padding: 4px 14px 8px;
}

html body #search {
  width: 100% !important;
  max-width: none;
  flex: none;
  min-height: 42px;
  margin: 0;
  padding: 0 15px 0 41px;
  border: 1px solid transparent !important;
  border-radius: 999px;
  background-color: var(--surface) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808080' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
  background-size: 18px;
  color: var(--text);
  font-size: 15px !important;
}

.search:focus {
  border-color: var(--line-strong) !important;
  background-color: var(--raised) !important;
}

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

.list-filters {
  display: none !important;
}

.chatgpt-scope-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: none;
  gap: 3px;
  margin: 0 14px 8px;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface);
}

.chatgpt-scope-tabs button {
  min-height: 34px;
  padding: 6px 8px;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chatgpt-scope-tabs button.selected {
  background: var(--raised);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] .chatgpt-scope-tabs button.selected {
  background: #484848;
  box-shadow: none;
}

.session-list-region {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.sessions {
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 0 8px max(14px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.sessions > h3,
.project-group > summary {
  margin: 0;
  padding: 14px 14px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.3;
}

.project-group {
  margin: 2px 0 6px;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: transparent;
}

.project-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

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

.project-group > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 3px;
  background: color-mix(in srgb, var(--text) 28%, transparent);
}

.project-group:not([open]) > summary {
  padding-bottom: 12px;
}

.project-group[open] {
  background: color-mix(in srgb, var(--surface) 58%, transparent);
}

.session {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 54px;
  margin: 1px 0;
  padding: 12px 14px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.session:hover,
.session:focus-visible,
.session.selected {
  background: var(--surface);
}

.session strong {
  display: block;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 15.5px;
  font-weight: 480;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session small,
.session-source,
.ds-session-type {
  display: none !important;
}

.session-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--muted);
}

.session-indicator.running {
  background: var(--gpt-green);
}

.session-indicator.complete,
.session-indicator.awaiting {
  background: var(--gpt-blue);
}

.session-indicator.unknown {
  background: var(--muted);
}

.session-list-region .list-sync,
#sessions-more {
  width: calc(100% - 20px);
  min-height: 42px;
  margin: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  color: var(--muted);
  font-size: 13px;
}

.ds-list-empty,
.sessions > p.muted {
  padding: 24px 14px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.host-errors {
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 10%, var(--page));
  color: var(--danger);
  font-size: 12px;
}

.sidebar-foot {
  display: none;
}

/* The main pane is hidden until a conversation is opened on phones. */

#main {
  display: none;
  min-width: 0;
  min-height: 0;
  background: var(--page);
}

.app.chat-open #sidebar {
  display: none;
}

.app.chat-open #main {
  display: flex;
  height: 100dvh;
}

.welcome {
  display: none;
}

/* Conversation */

.chat {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  background: var(--page);
}

.chat-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto 40px;
  min-height: calc(var(--header-height) + env(safe-area-inset-top));
  padding:
    max(8px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    8px
    max(6px, env(safe-area-inset-left));
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 94%, transparent);
  box-shadow: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

#back {
  display: inline-grid;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
}

#back:hover {
  background: var(--surface);
}

.chat-info {
  min-width: 0;
  padding: 0 2px;
}

.chat-title-button {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 5px 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title-button::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 0 2px 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  vertical-align: middle;
}

.quick-rename-button {
  display: none !important;
}

.chat-head > .client-icon {
  display: none !important;
}

html body #status {
  display: inline-block;
  width: 8px !important;
  min-width: 8px !important;
  height: 8px !important;
  min-height: 8px !important;
  padding: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 50% !important;
  background: var(--gpt-green) !important;
  color: transparent;
  font-size: 0;
}

html body #status.offline,
html body #status:empty {
  background: var(--muted) !important;
}

.status::before {
  display: none;
}

.chat-more-button {
  color: var(--text);
}

.workbench-tabs,
.wb-tabbar {
  display: none !important;
}

.timeline {
  min-height: 0;
  flex: 1;
  padding: 18px 15px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--page);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

#messages {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.timeline-row {
  margin-bottom: 20px;
}

.message {
  margin: 0 0 24px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  white-space: normal;
}

.message .who {
  display: none;
}

.message.user {
  width: fit-content;
  max-width: min(86%, 620px);
  margin: 4px 0 24px auto;
  padding: 10px 15px;
  border-radius: 22px 22px 6px 22px;
  background: var(--user);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.message.user .message-body {
  white-space: pre-wrap;
}

.message.assistant {
  position: relative;
  padding: 0 0 0 35px;
}

.message.assistant::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: url("/icon-ui.png?v=6d10ba17cc4e1645def3c0fed1358725e78eff587b1cf62833cf4a87f0092092") center / contain no-repeat;
}

.message.assistant .markdown-body {
  font-size: var(--message-size, 16px);
  line-height: var(--message-leading, 1.68);
}

.message.assistant .markdown-body p {
  margin-bottom: 15px;
}

.message.assistant .markdown-body p:last-child {
  margin-bottom: 0;
}

.message.error {
  margin-left: 35px;
  padding: 10px 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 8%, var(--page));
  color: var(--danger);
  font-size: 14px;
}

.message-actions {
  display: flex;
  min-height: 28px;
  margin-top: 7px;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  opacity: 0.72;
}

.message-actions button {
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.message-actions button:hover,
.message-actions button:focus-visible {
  background: var(--surface);
  color: var(--text);
}

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

.history,
.ds-history-older {
  display: block;
  min-height: 36px;
  margin: 0 auto 16px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--page);
  color: var(--muted);
  font-size: 12px;
}

html body #history {
  display: none !important;
}

.activity.timeline-row {
  margin: -4px 0 10px;
  padding: 0;
  color: var(--muted);
}

#messages > .activity:has(+ .activity),
.ds-messages > .activity:has(+ .activity) {
  display: none !important;
}

.activity > summary {
  display: flex;
  width: fit-content;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 9px 5px 29px;
  align-items: center;
  overflow: hidden;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.45;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.activity > summary::before {
  content: "";
  display: grid;
  position: absolute;
  width: 13px;
  height: 13px;
  margin-left: -20px;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--muted) 0 1.5px, transparent 2px);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.activity[open] > summary::before {
  content: "";
  border-color: var(--gpt-green);
  background:
    radial-gradient(circle at center, var(--gpt-green) 0 2.5px, transparent 3px);
}

.activity > summary:hover {
  background: var(--surface);
  color: var(--muted-strong);
}

.activity + .activity {
  margin-top: -8px;
}

.activity-body {
  max-height: 42dvh;
  margin: 4px 0 6px 29px;
  padding: 11px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--code);
  color: var(--muted-strong);
  font: 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.activity:not([open]) .detail-more {
  display: none;
}

.edited-files-card {
  margin: 0 0 14px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.edited-files-card > summary {
  display: flex;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px 10px 32px;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
}

.edited-files-card > summary::before {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  margin-left: -21px;
  border: 1.5px solid var(--gpt-green);
  border-radius: 50%;
}

.edited-files-list {
  border-top: 1px solid var(--line);
  background: var(--page);
}

.working {
  display: flex;
  margin: 2px 0 14px 35px;
  padding: 9px 0;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.working i {
  width: 8px;
  height: 8px;
  margin: 0;
  border-radius: 50%;
  background: var(--gpt-green);
  animation: gpt-pulse 1.35s ease-in-out infinite;
}

@keyframes gpt-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.notice {
  flex: none;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.notice .plain {
  padding: 4px 8px;
  color: var(--text);
}

.approval,
.queue-card {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.approval h3,
.approval strong {
  font-size: 14px;
}

.approval .actions {
  justify-content: flex-end;
  gap: 8px;
}

.approval .actions button,
.approval button {
  min-height: 40px;
  border-radius: 999px;
}

.approval pre,
.approval select,
.approval textarea,
.approval input {
  background: var(--code);
  color: var(--text);
}

.newer {
  position: absolute;
  right: 16px;
  bottom: 116px;
  z-index: 3;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--raised);
  color: var(--text);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.16);
  font-size: 12px;
}

/* Composer */

.composer {
  flex: none;
  margin: 0;
  padding:
    7px max(12px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  border-top: 0;
  background:
    linear-gradient(to bottom, transparent 0, var(--page) 14px, var(--page) 100%);
}

.composer-tools {
  display: flex;
  min-height: 30px;
  margin: 0;
  padding: 0 8px 3px;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.composer-tools::-webkit-scrollbar {
  display: none;
}

.tool-button {
  flex: none;
  max-width: none;
  min-height: 28px;
  padding: 4px 7px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
}

.tool-button:hover {
  background: var(--surface);
  color: var(--text);
}

#notify-button,
#skills-button,
#composer-toggle {
  display: none;
}

.ds-model {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ds-model-name {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#composer-body,
.ds-composer-body {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  grid-template-rows: auto auto;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px;
  align-items: end;
  gap: 6px 7px;
  border: 1px solid var(--line);
  border-radius: var(--composer-radius);
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

#composer-body:focus-within,
.ds-composer-body:focus-within {
  border-color: var(--line-strong);
}

.composer textarea,
.ds-composer-body textarea {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  max-height: 148px;
  margin: 0;
  padding: 5px 2px 4px;
  overflow-y: auto;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.48;
}

.composer textarea::placeholder,
.ds-composer-body textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.compose-bottom,
.ds-actions {
  display: contents;
}

.compose-bottom > select,
.ds-actions > select,
#mode-hint {
  display: none !important;
}

.attach-button {
  display: inline-grid;
  grid-column: 1;
  grid-row: 1;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  place-items: center;
  align-self: end;
  border: 0;
  border-radius: 50%;
  background: var(--page);
  color: var(--text);
}

.attach-button:hover {
  background: var(--surface-strong);
}

.attach-button svg {
  width: 18px;
  height: 18px;
}

.compose-actions {
  display: flex;
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  align-items: center;
  align-self: end;
  gap: 4px;
}

#send,
.ds-composer-body .primary {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--gpt-ink);
  color: var(--gpt-ink-opposite);
  font-size: 0;
}

#send::after {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(2px) rotate(45deg);
}

#send:disabled {
  background: var(--surface-strong);
  color: var(--muted);
  opacity: 1;
}

#stop,
.ds-composer-body .stop {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--gpt-ink);
  color: var(--gpt-ink-opposite);
  font-size: 0;
}

#stop::after,
.ds-composer-body .stop::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
}

#stop:not([hidden]) ~ #send {
  display: none;
}

.skill-pills,
.attachment-list,
#send-error,
.ds-composer-body > .error,
.ds-composer-body > .plain {
  grid-column: 1 / -1;
}

.skill-pills,
.attachment-list {
  margin: 0;
}

.skill-pill,
.attachment-chip {
  min-height: 30px;
  border-color: var(--line);
  background: var(--page);
  color: var(--muted-strong);
}

.compose-foot {
  display: none;
}

.goal-state {
  margin: 6px 14px 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

/* Dialogs and phone action sheets */

.picker {
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--page);
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.32);
}

.picker::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.picker-head {
  min-height: 38px;
  gap: 10px;
}

.picker-head h2 {
  min-width: 0;
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.35;
}

.picker input:not([type="checkbox"]):not([type="range"]):not([type="color"]),
.picker textarea,
.picker select {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.picker .primary,
.project-picker .project-picker-actions .primary {
  min-height: 44px;
  border-radius: 999px;
  background: var(--gpt-ink);
  color: var(--gpt-ink-opposite);
}

.chat-options-summary {
  display: flex;
  min-width: 0;
  margin: 8px 0 14px;
  padding: 12px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.chat-options-summary img {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
}

.chat-options-summary > div {
  min-width: 0;
}

.chat-options-summary p {
  margin: 0;
}

#details-title {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chat-meta {
  margin-top: 3px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-options-actions {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.chat-options-actions button {
  display: flex;
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
}

.chat-options-actions button:last-child {
  border-bottom: 0;
}

.chat-options-actions button:hover {
  background: var(--surface-strong);
}

.chat-detail-meta {
  display: grid;
  margin-top: 14px;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.chat-detail-execution {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toast {
  right: 14px;
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 82px));
  left: 14px;
  width: fit-content;
  max-width: calc(100% - 28px);
  margin: auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--page);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
  font-size: 13px;
  text-align: center;
}

.appearance-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.appearance-actions {
  position: sticky;
  bottom: -24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 14px 0 24px;
  background: var(--page);
}

.appearance-actions button {
  width: 100%;
  min-width: 0;
  border-radius: 999px;
}

/* Desktop keeps the same language with a stable two-pane layout. */

@media (min-width: 761px) {
  .app {
    display: grid;
    grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  }

  #sidebar {
    display: flex;
    border-right: 1px solid var(--line);
  }

  #main,
  .app.chat-open #main {
    display: flex;
  }

  .app.chat-open #sidebar {
    display: flex;
  }

  .list-heading {
    padding-inline: 20px 16px;
  }

  .chat-list-toolbar {
    padding-inline: 18px;
  }

  .chatgpt-scope-tabs {
    margin-inline: 18px;
  }

  .sessions {
    padding-inline: 10px;
  }

  .sidebar-foot {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    padding: 8px 12px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
  }

  .sidebar-foot button {
    min-width: 0;
    min-height: 36px;
    padding: 6px;
    overflow: hidden;
    border-radius: 9px;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #harness-open,
  #accounts-button,
  #pushplus-settings {
    display: block;
  }

  .welcome {
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
  }

  .chat-head {
    grid-template-columns: 42px minmax(0, 1fr) auto 42px;
    padding-inline: 12px 16px;
  }

  .timeline {
    padding-inline: max(20px, calc((100% - 800px) / 2));
  }

  .composer {
    padding-inline: max(20px, calc((100% - 800px) / 2));
  }

  .picker.chat-options-sheet {
    width: min(92vw, 440px);
  }

  .app:not(.chat-open) #main > #chat {
    display: none;
  }
}

@media (max-width: 760px) {
  .picker {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: 0;
    padding:
      18px max(18px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom))
      max(18px, env(safe-area-inset-left));
    overflow-y: auto;
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
    animation: sheet-in 180ms ease-out;
  }

  .picker::backdrop {
    animation: sheet-fade 180ms ease-out;
  }

  .chat-options-sheet {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .project-picker,
  #appearance-dialog,
  #model-dialog,
  #accounts-dialog,
  #webhook-dialog {
    height: min(92dvh, 820px);
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
  }

  .appearance-actions {
    bottom: calc(-1 * max(18px, env(safe-area-inset-bottom)));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  @keyframes sheet-in {
    from {
      opacity: 0.7;
      transform: translateY(28px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes sheet-fade {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

@media (max-width: 360px) {
  .list-heading {
    padding-inline: 12px 10px;
  }

  .chat-list-toolbar {
    padding-inline: 10px;
  }

  .chatgpt-scope-tabs {
    margin-inline: 10px;
  }

  .sessions {
    padding-inline: 5px;
  }

  .session {
    padding-inline: 12px;
  }

  .session strong {
    font-size: 15px;
  }

  .timeline {
    padding-inline: 12px;
  }

  .composer {
    padding-inline: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .picker,
  .picker::backdrop,
  .working i {
    animation: none !important;
  }
}
