.mobile-app {
  --mobile-surface: #f5f7f4;
  --mobile-white: #fff;
  height: var(--mobile-viewport-height, 100dvh);
  background: var(--mobile-surface);
}

.mobile-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 13px;
  padding: max(8px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 6px max(18px, env(safe-area-inset-left));
}

#mobile-guest-language {
  margin-inline-start: auto;
}

.mobile-heading {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 2px;
}

.mobile-heading .chat-brand {
  font-size: 1.4rem;
  line-height: 1.15;
}

.mobile-menu-button, .mobile-send {
  display: grid;
  place-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.mobile-menu-button {
  border: 1px solid var(--line);
  background: var(--mobile-white);
  box-shadow: 0 3px 12px #25413909;
}

.mobile-menu-button span {
  display: grid;
  gap: 5px;
  width: 19px;
}

.mobile-menu-button span::before, .mobile-menu-button span::after {
  content: "";
  height: 2px;
  border-radius: 4px;
  background: currentColor;
}

.mobile-menu-button span::after {
  width: 66%;
}

.mobile-mode-switch, .mobile-model-switch {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  border: 0;
  background: transparent;
  text-align: start;
}

.mobile-mode-switch {
  min-height: 28px;
  padding: 1px 5px 1px 0;
  color: var(--muted);
  font-size: .85rem;
}

.mobile-chevron {
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.mobile-mode-switch .mobile-chevron {
  transform: rotate(-45deg);
}

.mobile-app .chat-layout {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-app .chat-main {
  grid-template-columns: minmax(0, 1fr);
}

.mobile-app .chat-scroll {
  grid-row: 2;
}

.mobile-app .chat-composer {
  grid-row: 3;
}

.mobile-conversation-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 4px max(17px, calc((100% - 710px) / 2));
  border-bottom: 1px solid #deeadf;
  color: var(--muted);
  font-size: .9rem;
}

.mobile-conversation-bar .chat-context { min-width: 0; }

.mobile-app .chat-content, .mobile-app .chat-composer {
  width: min(100% - 32px, 710px);
}

.mobile-app .chat-message[data-role="assistant"] {
  width: 100%;
}

.chat-reply-content {
  display: flow-root;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.chat-reply-content > :first-child { margin-top: 0; }
.chat-reply-content > :last-child { margin-bottom: 0; }
.chat-reply-content p { margin: 0 0 .84em; }
.chat-reply-content :is(h1, h2, h3, h4, h5, h6) {
  margin: 1.28em 0 .42em;
  color: #153a2f;
  font-size: 1.02rem;
  line-height: 1.37;
}
.chat-reply-content :is(h1, h2) { font-size: 1.15rem; }
.chat-reply-content :is(ul, ol) { margin: 0 0 .86em; padding-inline-start: 1.55em; }
.chat-reply-content :is(ul, ol) :is(ul, ol) { margin: .26em 0 0; }
.chat-reply-content li + li { margin-top: .27em; }
.chat-reply-content li > p:last-child { margin-bottom: 0; }
.chat-reply-content a { color: #225a46; text-underline-offset: 3px; }
.chat-reply-content hr { border: 0; border-top: 1px solid #cadbd0; margin: 1.2em 0; }
.chat-reply-content blockquote {
  margin: 0 0 .9em;
  padding: .25em 0 .25em .78em;
  border-inline-start: 3px solid #91b5a0;
  color: #395b4d;
}
.chat-reply-content blockquote > :last-child { margin-bottom: 0; }
.chat-reply-content :not(pre) > code {
  border-radius: 4px;
  padding: .12em .28em;
  background: #dfebe2;
  font: .88em ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.chat-reply-table {
  overflow: auto;
  margin: 0 0 .9em;
  border: 1px solid #c7dacf;
  border-radius: 10px;
  background: #fbfcf8;
}
.chat-reply-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: .89rem;
  line-height: 1.48;
}
.chat-reply-table :is(th, td) {
  min-width: 6.5ch;
  padding: 8px 10px;
  border-bottom: 1px solid #e0e9e0;
  text-align: start;
}
.chat-reply-table th { color: #214836; background: #e6efe6; }
.chat-reply-table tr:last-child td { border-bottom: 0; }
.chat-reply-table tbody tr:nth-child(even) { background: #f3f7f0; }
.chat-reply-table .chat-cell-left { text-align: left; }
.chat-reply-table .chat-cell-center { text-align: center; }
.chat-reply-table .chat-cell-right { text-align: right; }

.chat-reply-code {
  overflow: hidden;
  margin: 0 0 .9em;
  border: 1px solid #244038;
  border-radius: 11px;
  background: #142822;
  color: #e8f5eb;
}
.chat-reply-code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding-inline: 11px 7px;
  background: #1f3a30;
  color: #cce0d1;
  font-size: .79rem;
}
.chat-reply-code-header > span:first-child { margin-inline-end: auto; }
.chat-reply-content .chat-reply-code pre {
  overflow: auto;
  padding: 13px 12px;
  font: .83rem/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace;
  white-space: pre;
  overflow-wrap: normal;
}
.chat-reply-code pre code { font: inherit; }

.chat-reply-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: #426451;
}
.chat-copy-action {
  min-height: 34px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.chat-copy-action:is(:active, :focus-visible) {
  border-color: currentColor;
  background: #779a8a24;
}
.chat-copy-status, .chat-message-note { font-size: .76rem; color: inherit; }
.chat-message-note { display: block; margin-top: .5em; color: var(--muted); }
.chat-copy-buffer {
  position: fixed;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mobile-app .chat-welcome {
  margin: clamp(38px, 22dvh, 188px) auto 24px;
  padding-inline: clamp(4px, 2.5vw, 20px);
  text-align: start;
}

.mobile-app .chat-welcome h1 {
  margin: 0;
  font-size: clamp(1.54rem, 6.4vw, 2.34rem);
  letter-spacing: -.045em;
}

.mobile-suggestions {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-top: 19px;
}

.mobile-suggestions button {
  min-height: 39px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--mobile-white);
  color: var(--ink);
  font-size: .88rem;
}

.mobile-suggestions button:hover {
  background: #e8f0e8;
}

.mobile-app .chat-composer {
  padding-block: 8px 5px;
  background: transparent;
}

.mobile-app .mobile-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 10px 11px 8px;
  border: 1px solid #dce6dd;
  border-radius: 24px;
  background: var(--mobile-white);
  box-shadow: 0 6px 22px #2c5b4012;
}

.mobile-app .mobile-composer:focus-within {
  border-color: #81a691;
}

.mobile-composer textarea {
  min-height: 37px;
  max-height: min(29dvh, 132px);
  padding: 3px 4px;
}

.mobile-composer-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.mobile-model-switch {
  flex: 0 1 auto;
  max-width: 26ch;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent);
  background: #e8f0e8;
  font-size: .88rem;
  font-weight: 640;
}

.mobile-model-switch > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-composer-tools #stop {
  margin-inline-start: auto;
}

.mobile-tool {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
}
.mobile-tool:hover, .mobile-tool[aria-pressed="true"] { background: #edf3ed; }
.mobile-add { margin-inline-start: auto; font-size: 1.52rem; }
.mobile-voice > span { position: relative; width: 12px; height: 15px; border: solid currentColor; border-width: 0 1.7px 1.7px; border-radius: 0 0 8px 8px; }
.mobile-voice > span::before { position: absolute; inset: -3px 2px 3px; border: 1.6px solid currentColor; border-radius: 5px; content: ""; }
.mobile-voice > span::after { position: absolute; inset: auto 4px -5px; height: 4px; background: currentColor; content: ""; }

.mobile-send {
  position: relative;
  width: 40px;
  height: 40px;
  margin-inline-start: 0;
  border: 0;
  color: #fff;
  background: var(--accent);
}

.mobile-send::before, .mobile-send::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
}

.mobile-send::before {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translate(-50%, -5px) rotate(45deg);
}

.mobile-send::after {
  width: 2px;
  height: 14px;
  border-radius: 3px;
  background: currentColor;
  transform: translate(-50%, -6px);
}

.mobile-app #chat-status, .mobile-app #remote-status {
  margin-inline: 6px;
}

.mobile-app #chat-status:empty, .mobile-app #remote-status:empty,
.mobile-app #remote-hint:empty, .mobile-app #sign-in-status:empty {
  display: none;
}

.mobile-app #remote-browse, .mobile-app #remote-sign-in { margin-top: 13px; }
.mobile-app .chat-composer:has(#remote-composer[hidden]):has(#remote-status:empty) { display: none; }

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex: none;
  justify-content: space-evenly;
  gap: 4px;
  padding: 5px 16px max(5px, env(safe-area-inset-bottom));
  border-top: 1px solid #dfe8df;
  background: #fbfcfa;
}

.mobile-app.mobile-keyboard .mobile-tabs {
  display: none;
}

.mobile-tabs button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  flex: 1;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem;
}

.mobile-tabs button[aria-pressed="true"] {
  color: var(--accent);
  font-weight: 690;
}

.mobile-tab-chat, .mobile-tab-account, .mobile-tab-desktop, .mobile-tab-schedule {
  position: relative;
  display: block;
  width: 17px;
  height: 15px;
}

.mobile-tab-chat {
  border: 1.6px solid currentColor;
  border-radius: 6px;
}

.mobile-tab-desktop { width: 19px; border: 1.6px solid currentColor; border-radius: 4px; }
.mobile-tab-desktop::after { position: absolute; inset: auto 4px -4px; border-bottom: 1.6px solid currentColor; content: ""; }
.mobile-tab-schedule { width: 17px; height: 17px; border: 1.6px solid currentColor; border-radius: 50%; }
.mobile-tab-schedule::after { position: absolute; inset: 3px 3px 6px 6px; border: solid currentColor; border-width: 0 0 1.6px 1.6px; content: ""; }

.mobile-tab-chat::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 4px;
  width: 4px;
  height: 4px;
  transform: rotate(45deg);
  background: var(--mobile-surface);
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
}

.mobile-tab-account::before, .mobile-tab-account::after {
  content: "";
  position: absolute;
  left: 50%;
  border: 1.6px solid currentColor;
  transform: translateX(-50%);
}

.mobile-tab-account::before {
  width: 5px;
  height: 5px;
  top: -1px;
  border-radius: 50%;
}

.mobile-tab-account::after {
  inset-block-end: 0;
  width: 13px;
  height: 5px;
  border-radius: 9px 9px 3px 3px;
}

.mobile-drawer {
  inset: 0 auto 0 0;
  width: min(84vw, 355px);
  max-width: none;
  height: 100%;
  max-height: none;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  margin: 0;
  border: 0;
  border-radius: 0 23px 23px 0;
  color: var(--ink);
  background: var(--mobile-surface);
  overflow: auto;
  box-shadow: 10px 0 36px #0f2a2321;
}

.mobile-drawer::backdrop, .mobile-sheet::backdrop {
  background: #192d2550;
}

.mobile-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.mobile-drawer-mode {
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.mobile-drawer-mode .mobile-chevron {
  transform: translateY(-2px) rotate(45deg);
}

.mobile-drawer-pane .new-chat {
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-bottom: 13px;
  border-radius: 999px;
}

.mobile-drawer-pane h2 {
  margin: 12px 7px 6px;
  font-size: .85rem;
  font-weight: 650;
  color: var(--muted);
}

.mobile-drawer-pane .chat-list button {
  min-height: 40px;
  border-radius: 12px;
  padding-inline: 12px;
}

.mobile-mode-options, .mobile-account-actions {
  display: grid;
  gap: 8px;
}

.mobile-mode-options button, .mobile-account-row {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mobile-white);
  text-align: start;
}

.mobile-mode-options button {
  display: grid;
  font-weight: 680;
}

.mobile-mode-options button[aria-pressed="true"] {
  border-color: #9ab9a5;
  background: #e5f0e6;
}

.mobile-mode-options small {
  color: var(--muted);
  font-size: .83rem;
  font-weight: 430;
}

.mobile-account-actions #account-identity {
  max-width: 18ch;
  color: var(--ink);
}

.mobile-account-view { flex: 1; min-height: 0; overflow-y: auto; }
.mobile-account-inner { display: grid; align-content: start; gap: 12px; width: min(100% - 36px, 560px); margin: 22px auto; }
.mobile-account-inner h1 { margin: 0 0 3px; font-size: 1.7rem; }
.mobile-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mobile-schedule-status, .mobile-panel-status { margin: 3px 0; color: var(--muted); font-size: .87rem; }
.mobile-schedule-status:empty, .mobile-panel-status:empty, .mobile-schedule-list:empty { display: none; }
.mobile-schedule-button { justify-self: start; }
#mobile-schedule-device { max-width: 70%; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: #f5f8f5; }
.mobile-schedule-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.mobile-task-row { display: grid; width: 100%; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-align: start; background: var(--mobile-white); }
.mobile-task-row strong { overflow-wrap: anywhere; }
.mobile-task-row small, .mobile-panel-list small { color: var(--muted); font-size: .8rem; }
.mobile-task-row:is(button):hover { background: #edf4ee; }
.mobile-page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.mobile-page-heading > h1 { min-width: 0; }
.mobile-page-heading > .mobile-page-actions { flex: none; }
.mobile-page-actions button, #computer-refresh { padding-inline: 11px; }
#computer-dashboard { min-width: 0; }
.mobile-device-list { display: grid; gap: 7px; }
.mobile-device-list:empty { display: none; }
.mobile-device-list button { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 49px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; text-align: start; background: var(--mobile-white); overflow-wrap: anywhere; }
.mobile-device-list small { flex: none; border-radius: 20px; padding: 3px 8px; color: #49574f; background: #eef1ed; }
.mobile-device-list small.is-online { color: #185c39; background: #e4f3e7; }
.mobile-device-list button[aria-current="true"] { border-color: #77a488; background: #f6fbf6; }
.mobile-panel { min-width: 0; margin-top: 5px; }
.mobile-panel h2, .mobile-panel h3 { margin: 0 0 6px; color: var(--ink); font-size: .95rem; }
.mobile-panel-list { display: grid; min-width: 0; gap: 3px; margin: 0; padding: 0; list-style: none; }
.mobile-panel-list button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 8px 11px; overflow-wrap: anywhere; border: 0; border-radius: 8px; background: var(--mobile-white); text-align: start; }
.mobile-panel-list button:hover, .mobile-panel-list button[aria-current="true"] { background: #e8f2e9; }
.mobile-workspace-actions { display: grid; gap: 5px; margin-top: 9px; padding-inline-start: 8px; border-inline-start: 2px solid var(--line); }
.mobile-workspace-actions > button, #schedule-history-more, #schedule-result-chat { justify-self: start; margin-top: 5px; }
#schedule-detail .mobile-page-actions { justify-content: flex-start; }
#schedule-detail .mobile-task-instruction { max-height: 122px; padding: 9px 11px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 9px; background: #edf3ed; }
#schedule-detail .mobile-task-instruction:empty, #schedule-detail-status:empty, #schedule-new-status:empty { display: none; }
#schedule-result-body { padding: 0; }
#schedule-result-body .chat-message { margin: 0; }
.mobile-schedule-timing { display: grid; gap: 5px; }
#schedule-form textarea { width: 100%; min-height: 72px; padding: 8px 10px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
#schedule-timezone { margin: 0; font-size: .77rem; }
#remote-stop { padding-inline: 7px; }
.mobile-account-card { display: flex; align-items: start; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--mobile-white); }
.mobile-account-card img { flex: none; border-radius: 11px; }
.mobile-account-card h2 { margin: 0; font-size: 1.05rem; }
.mobile-account-card p { margin: 3px 0 10px; color: var(--muted); font-size: .87rem; }
.mobile-account-actions button { justify-self: start; }
.mobile-input-status { margin: 2px 7px 0; color: var(--muted); font-size: .78rem; }
.mobile-input-status:empty { display: none; }
.mobile-attachment-list { display: flex; gap: 6px; flex-wrap: wrap; padding-inline: 3px; }
.mobile-attachment { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; gap: 3px; padding-inline-start: 8px; border: 1px solid var(--line); border-radius: 8px; background: #edf4ee; font-size: .78rem; }
.mobile-attachment > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-attachment button { min-width: 32px; min-height: 30px; padding: 0; border: 0; background: transparent; }
.chat-image-thumbnail { width: 52px; height: 52px; border-radius: 7px; background: #edf3ed; }
.mobile-attachment .chat-image-thumbnail { flex: none; width: 33px; height: 33px; margin-block: 3px; }
.mobile-attachment-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mobile-attachment-actions button { flex: 1; min-height: 50px; padding-inline: 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.mobile-attachment-actions button:hover { background: #edf4ee; }

@media (max-width: 700px) {
  .mobile-app .mobile-sheet {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: 90%;
    margin: 0;
    padding: 19px 18px max(18px, env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 23px 23px 0 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .mobile-drawer[open] {
    animation: mobile-drawer-in .22s ease-out;
  }

  @keyframes mobile-drawer-in {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
  }
}
