.mobile-chat-header,
.mobile-panel-close,
.mobile-panel-backdrop {
  display: none;
}

body.is-mobile {
  /* Match PC canvas (--sw-bg-main / --workspace-bg). */
  background: var(--sw-bg-main);
  --mobile-safe-top: env(safe-area-inset-top, 0px);
  --mobile-safe-right: env(safe-area-inset-right, 0px);
  --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-safe-left: env(safe-area-inset-left, 0px);
  --mobile-header-height: 52px;
  --mobile-ctrl: 44px;
  --mobile-font: 14px;
  --mobile-font-sm: 12.5px;
  --mobile-font-xs: 11.5px;
  --mobile-viewport-height: 100vh;
  --mobile-viewport-height: 100svh;
  --mobile-viewport-height: 100dvh;
  --mobile-keyboard-inset: 0px;
  /* Open and close use the same duration everywhere. */
  --mobile-motion-dur: 0.48s;
  --mobile-motion-ease: var(--sw-motion-soft);
  /*
   * Mobile UI copy is RU/EN. Display face is Onest (Cyrillic + Latin).
   */
  --sw-font-display: var(--sw-font-ui, var(--sw-font));
  --font: var(--sw-font);
  --font-display: var(--sw-font-display);
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  height: var(--mobile-viewport-height);
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--sw-font);
  font-size: var(--mobile-font);
  line-height: var(--sw-line-tight, 1.35);
  letter-spacing: 0;
  font-kerning: normal;
  font-optical-sizing: auto;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Brand Latin wordmarks may still use Syne if loaded; otherwise Onest. */
body.is-mobile .login-wordmark,
body.is-mobile .boot-logo {
  font-family: "Syne", var(--sw-font);
}

/* Shared mobile UI text - project face, readable tracking */
body.is-mobile .login-heading,
body.is-mobile .login-lead,
body.is-mobile .mobile-chat-header__title,
body.is-mobile .sidebar-brand-title,
body.is-mobile .composer-attach-cat,
body.is-mobile .composer-tool__label,
body.is-mobile .tg-file,
body.is-mobile .tg-file__name,
body.is-mobile .tg-file__meta,
body.is-mobile .session-item,
body.is-mobile .new-chat-btn,
body.is-mobile .msg,
body.is-mobile .composer-card__input,
body.is-mobile .composer-ph,
body.is-mobile label,
body.is-mobile button,
body.is-mobile input,
body.is-mobile textarea {
  font-family: var(--sw-font);
}

body.is-mobile .login-heading {
  letter-spacing: -0.02em;
  font-weight: 700;
}

body.is-mobile .mobile-chat-header__title {
  font-family: var(--sw-font);
  font-weight: 600;
  letter-spacing: -0.015em;
}

body.is-mobile .sidebar-brand-title {
  font-family: "Syne", var(--sw-font);
  font-weight: 700;
  letter-spacing: -0.03em;
}

body.is-mobile .composer-attach-cat {
  font-family: var(--sw-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 5px 2px 7px;
}

body.is-mobile .composer-tool__label {
  font-family: var(--sw-font);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
}

body.is-mobile .tg-file__name {
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0;
}

body.is-mobile .tg-file__meta,
body.is-mobile .tg-file__icon {
  font-family: var(--sw-font);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

body.is-mobile.mobile-panel-open {
  touch-action: none;
}

body.is-mobile #login-screen {
  width: 100%;
  min-height: var(--mobile-viewport-height);
  height: var(--mobile-viewport-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(10px, var(--mobile-safe-top))
    max(16px, var(--mobile-safe-right))
    max(6px, var(--mobile-safe-bottom))
    max(16px, var(--mobile-safe-left));
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  background: #ffffff;
}

body.is-mobile #login-screen .login-scene {
  width: 100%;
  max-width: 21.5rem;
  margin-inline: auto;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

body.is-mobile #login-screen .login-scene,
body.is-mobile #login-screen .login-scene.login-scene--reel-open {
  max-width: 21.5rem;
}

body.is-mobile .login-window {
  width: 100%;
  max-width: 21.5rem;
  border-radius: 12px;
}

body.is-mobile #login-screen .login-window.window-panel {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #111111;
}

body.is-mobile #login-screen .login-window.window-panel.login-card {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  border-radius: 12px;
  transition: border-radius 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-mobile #login-screen .login-scene.login-scene--reel-open .login-window.window-panel.login-card {
  border-radius: 0 0 12px 12px;
}

body.is-mobile #login-screen .login-card__visual {
  display: none !important;
}

body.is-mobile #login-screen label {
  margin-bottom: 6px;
  font-size: 13px;
  font-family: var(--login-font-ui, "Outfit", "Segoe UI", sans-serif);
  letter-spacing: 0;
  text-transform: none;
  color: #6b6b6b;
}

body.is-mobile #login-screen input {
  font-size: 16px;
  padding: 11px 13px;
  background: #fff;
  color: #111;
  border-color: #e6e6e6;
}

body.is-mobile #login-screen #login-btn {
  margin-top: 6px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: var(--login-font-ui, "Outfit", "Segoe UI", sans-serif);
  letter-spacing: 0;
  text-transform: none;
  background: #111111 !important;
  box-shadow: none !important;
}

body.is-mobile #login-screen .login-window-body {
  /* Bottom inset comes from .login-support padding (equal to gap above the label). */
  padding: 24px 20px 0;
}

body.is-mobile #login-screen .login-wordmark {
  margin-bottom: 9px;
  font-size: 11px;
}

body.is-mobile #login-screen .login-greet {
  margin-bottom: 14px;
  font-size: clamp(1.75rem, 8vw, 2.25rem);
  line-height: 1.12;
  text-align: center;
  /* Same face as landing hero / benefits (Outfit). */
  font-family: var(--login-font-display, "Outfit", "Segoe UI", sans-serif);
  font-weight: 600;
  letter-spacing: -0.035em;
  color: #111111;
}

body.is-mobile #login-screen .login-heading,
body.is-mobile #login-screen .login-lead,
body.is-mobile #login-screen .login-card__visual {
  display: none !important;
}

body.is-mobile #login-screen .login-field {
  margin-bottom: 12px;
}

body.is-mobile #login-screen label {
  margin-bottom: 6px;
  font-size: 10px;
}

body.is-mobile #login-screen .login-hint {
  margin: 12px 0 0;
  padding-top: 0;
  border-top: none;
  font-size: var(--mobile-font-xs);
  line-height: 1.45;
  text-align: center;
}

body.is-mobile #login-screen .login-support {
  align-self: stretch;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  margin: 12px 0 0;
  border: 0;
  border-radius: 999px;
  /* Equal 16px: divider line → label and label → bottom of card. */
  padding: 16px 14px;
  font-size: 13px;
  background-color: transparent;
  background-image: linear-gradient(#ececec, #ececec);
  background-size: 100% 1px;
  background-position: top center;
  background-repeat: no-repeat;
}

body.is-mobile #login-screen .login-support:hover {
  background-color: rgba(0, 0, 0, 0.06);
  background-image: linear-gradient(#ececec, #ececec);
  background-size: 100% 1px;
  background-position: top center;
  background-repeat: no-repeat;
}

body.is-mobile #login-screen .login-support:active {
  background-color: rgba(0, 0, 0, 0.1);
  background-image: linear-gradient(#ececec, #ececec);
  background-size: 100% 1px;
  background-position: top center;
  background-repeat: no-repeat;
}

body.is-mobile #login-screen input,
body.is-mobile #login-screen #login-btn {
  /* Keep ≥16px on inputs to avoid iOS focus zoom. */
  min-height: 42px;
  border-radius: 11px;
}

body.is-mobile #login-screen input {
  font-size: 16px;
  padding: 11px 13px;
}

body.is-mobile #login-screen #login-btn {
  margin-top: 4px;
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: none !important;
}

body.is-mobile #login-screen #error-msg {
  margin-top: 8px;
  font-size: var(--mobile-font-sm);
}

/* Mobile reel: sequential upward reveal ABOVE the form (desktop keeps side slide). */
body.is-mobile #login-screen .login-reel {
  display: block;
  order: -1;
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  height: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(40px);
  border-radius: 12px 12px 0 0;
  background: #0c0c0e;
  pointer-events: none;
  z-index: 1;
  transition:
    height 1.25s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.1s,
    transform 1.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-mobile #login-screen .login-scene.login-scene--reel-open .login-reel {
  height: clamp(160px, 38vw, 220px);
  opacity: 1;
  transform: translateY(0);
}

body.is-mobile #login-screen .login-reel__stage {
  position: absolute;
  inset: 0;
}

body.is-mobile #login-screen .login-reel__video {
  object-position: center 35%;
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile #login-screen .login-reel {
    transition: none !important;
    transform: none !important;
  }

  body.is-mobile #login-screen .login-scene.login-scene--reel-open .login-reel {
    opacity: 1;
    height: clamp(160px, 38vw, 220px);
  }
}

/* Soft agent (chat) appearance — opacity + slight rise */
body.is-mobile #app-screen.hypr-workspace {
  transition:
    opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

body.is-mobile #app-screen.hypr-workspace.mode-screen--preparing,
body.is-mobile #app-screen.hypr-workspace:not(.chat-screen--visible):not(.hidden) {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  pointer-events: none;
}

body.is-mobile #app-screen.hypr-workspace.chat-screen--visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile #app-screen.hypr-workspace {
    transition: none !important;
    transform: none !important;
  }
}

body.is-mobile #app-screen.hypr-workspace {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: 0;
  min-height: var(--mobile-viewport-height);
  height: var(--mobile-viewport-height);
  padding: var(--mobile-safe-top) 0 0;
  overflow: hidden;
  font-size: var(--mobile-font);
}

body.is-mobile #app-screen.hidden {
  display: none !important;
}

body.is-mobile .mobile-chat-header {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex: 0 0 var(--mobile-header-height);
  min-height: var(--mobile-header-height);
  margin: 6px max(8px, var(--mobile-safe-right)) 0 max(8px, var(--mobile-safe-left));
  padding: 5px 8px;
  border: 0;
  border-radius: 14px;
  background: var(--sw-bg-main);
  box-shadow: none;
}

body.is-mobile .mobile-chat-header__side {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

body.is-mobile .mobile-chat-header__side--left {
  min-width: var(--mobile-ctrl);
}

body.is-mobile .mobile-chat-header__side--right {
  justify-content: flex-end;
  min-width: calc(var(--mobile-ctrl) * 2 + 5px);
}

body.is-mobile .mobile-chat-header__title {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 0;
  transform: translateY(-50%);
  min-width: 0;
  max-width: none;
  margin: 0;
  padding:
    0 calc(var(--mobile-ctrl) * 2 + 19px)
    0 calc(var(--mobile-ctrl) + 14px);
  overflow: hidden;
  color: var(--sw-text-main);
  font-family: var(--sw-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

body.is-mobile .mobile-docs-icon {
  display: block;
  width: 17px;
  height: 17px;
}

body.is-mobile .mobile-chat-header__btn--docs {
  position: relative;
  color: rgba(176, 184, 198, 0.78);
}

body.is-mobile .mobile-chat-header__btn--docs:hover,
body.is-mobile .mobile-chat-header__btn--docs:active {
  color: rgba(230, 234, 242, 0.96);
  background: var(--sw-btn-secondary-hover);
  transform: scale(0.96);
}

body.is-mobile .mobile-chat-header__btn--docs[aria-expanded="true"] {
  color: rgba(236, 240, 246, 0.96);
  background: rgba(255, 255, 255, 0.08);
}

body.is-mobile .mobile-docs-count {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 14px;
  height: 14px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.92);
  color: #0b0c10;
  font: 700 9px/14px var(--sw-font-mono, var(--sw-font));
  letter-spacing: 0;
  text-align: center;
  box-shadow: 0 0 0 1.5px rgba(12, 11, 16, 0.9);
}

body.is-mobile .mobile-chat-header__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--mobile-ctrl);
  min-width: var(--mobile-ctrl);
  height: var(--mobile-ctrl);
  min-height: var(--mobile-ctrl);
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: var(--sw-btn-secondary-bg);
  color: var(--sw-text-muted);
  font: 600 14px/1 var(--sw-font-mono);
  line-height: 0;
  cursor: pointer;
  transition:
    color 0.28s var(--sw-motion-soft),
    background 0.28s var(--sw-motion-soft),
    transform 0.28s var(--sw-motion-soft);
}

body.is-mobile .mobile-chat-header__btn--sessions {
  background: transparent;
  color: rgba(176, 184, 198, 0.78);
}

body.is-mobile .mobile-chat-header__btn--sessions:hover,
body.is-mobile .mobile-chat-header__btn--sessions:active,
body.is-mobile .mobile-chat-header__btn.mobile-chat-header__btn--sessions:active {
  color: rgba(230, 234, 242, 0.96);
  background: transparent;
  transform: scale(0.96);
}

body.is-mobile .mobile-chat-header__btn--sessions[aria-expanded="true"] {
  color: rgba(236, 240, 246, 0.96);
  background: transparent;
}

body.is-mobile .mobile-sessions-icon {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
  /* Match idle mic glyph: soft white via composer-send-voice opacity 0.92 */
  color: rgba(255, 255, 255, 0.92);
  fill: currentColor;
  opacity: 1;
  shape-rendering: geometricPrecision;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

body.is-mobile .mobile-chat-header__btn:active {
  color: var(--sw-text-main);
  background: var(--sw-btn-secondary-hover);
  transform: scale(0.96);
}

body.is-mobile .mobile-panel-close,
body.is-mobile .btn-modal-close {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.42);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  opacity: 1;
  transition:
    color 0.28s var(--sw-motion-soft),
    background 0.28s var(--sw-motion-soft);
}

body.is-mobile .mobile-panel-close:hover,
body.is-mobile .btn-modal-close:hover,
body.is-mobile .mobile-panel-close:active,
body.is-mobile .btn-modal-close:active {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
  transform: none;
}

body.is-mobile .mobile-close-icon {
  display: block;
  width: 17px;
  height: 17px;
}

body.is-mobile .mobile-chat-header__btn[aria-expanded="true"] {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.13);
}

body.is-mobile #win-chat.main.chat-space.window-panel {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  border-radius: 0;
}

body.is-mobile #win-chat > .window-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

body.is-mobile #messages.messages-area {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  padding: 12px 16px 10px;
  gap: 12px;
  scroll-padding-bottom: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  /* pan-x needed so nested .msg-table-wrap can scroll sideways (ancestor
     touch-action is intersected; pan-y alone blocks child horizontal pans). */
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  overflow-anchor: none;
  /* Do not use contain/isolation here — breaks touch scroll on some WebViews */
  will-change: auto;
  pointer-events: auto;
}

body.is-mobile .msg.assistant .msg-actions--icons {
  gap: 0;
}
body.is-mobile .msg-action-btn--icon {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  /* Quieter than desktop; tap-highlight inherits from .msg-action-btn. */
  color: rgba(255, 255, 255, 0.48);
}
body.is-mobile .msg-action-btn--icon:hover:not(:disabled) {
  color: rgba(255, 255, 255, 0.48);
  background: transparent;
}
body.is-mobile .msg-action-btn--icon:focus:not(:focus-visible) {
  color: rgba(255, 255, 255, 0.48);
  background: transparent;
}
body.is-mobile .msg-action-btn--icon:active:not(:disabled) {
  color: rgba(255, 255, 255, 0.88);
  /* Brief press only — no lingering flash after finger lift. */
  background: rgba(255, 255, 255, 0.04);
  transition-duration: 0.08s;
}
body.is-mobile .msg-action-btn--icon.is-icon-success {
  /* Keep button muted; check itself is forced bright below. */
  color: rgba(255, 255, 255, 0.48);
  background: transparent;
}
body.is-mobile .msg-action-btn--icon.is-icon-success:focus,
body.is-mobile .msg-action-btn--icon.is-icon-success:active {
  color: rgba(255, 255, 255, 0.48);
  background: transparent;
}
body.is-mobile .msg-action-btn--icon.is-icon-success .msg-action-icon-swap__ok,
body.is-mobile .msg-action-btn--icon.is-icon-success svg.msg-check-icon {
  color: #ffffff;
}
body.is-mobile .msg-action-btn--icon.is-icon-success .msg-action-icon-swap__ok path {
  stroke: #ffffff;
}
body.is-mobile .msg-action-btn--icon svg.msg-copy-icon,
body.is-mobile .msg-action-btn--icon svg.msg-export-icon,
body.is-mobile .msg-action-btn--icon svg.msg-resend-icon,
body.is-mobile .msg-action-btn--icon svg.msg-check-icon {
  width: 19px;
  height: 19px;
}
body.is-mobile .msg-action-icon-swap {
  width: 19px;
  height: 19px;
}

body.is-mobile .msg {
  max-width: 90%;
  font-family: var(--sw-font);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: 0;
  font-weight: 400;
}

body.is-mobile .msg.assistant .msg-body h2 {
  font-family: var(--sw-font);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

body.is-mobile .msg.assistant .msg-body h3 {
  font-family: var(--sw-font);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

body.is-mobile .msg.assistant .msg-body hr.msg-hr,
body.is-mobile .msg.assistant .msg-body hr {
  margin: 14px 0;
}

body.is-mobile .msg.assistant .msg-body p,
body.is-mobile .msg.assistant .msg-body li,
body.is-mobile .msg.user {
  font-family: var(--sw-font);
  font-size: var(--mobile-font);
  letter-spacing: 0;
}

body.is-mobile .msg-source-cite {
  width: 1em;
  height: 1em;
  margin: 0;
  vertical-align: -0.1em;
}

/*
 * Source cite strip (checkmark → document pointer): mobile open/close.
 * Closed state = close timings; .is-open overrides = open timings (asymmetric).
 */
body.is-mobile .composer-source-cite {
  --cite-open-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cite-open-spring: cubic-bezier(0.22, 1.18, 0.28, 1);
  --cite-close-ease: cubic-bezier(0.4, 0, 0.7, 0.2);
  --cite-close-fade: cubic-bezier(0.4, 0, 1, 1);
  transform: translate3d(0, 10px, 0);
  transition:
    grid-template-rows 0.28s var(--cite-close-ease),
    opacity 0.2s var(--cite-close-fade),
    transform 0.28s var(--cite-close-ease),
    margin 0.28s var(--cite-close-ease);
  will-change: transform, opacity;
}

body.is-mobile .composer-source-cite.is-open {
  transform: translate3d(0, 0, 0);
  transition:
    grid-template-rows 0.44s var(--cite-open-ease),
    opacity 0.34s var(--cite-open-ease) 0.03s,
    transform 0.44s var(--cite-open-spring),
    margin 0.44s var(--cite-open-ease);
}

body.is-mobile .composer-source-cite__row {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity 0.18s var(--cite-close-fade),
    transform 0.22s var(--cite-close-ease);
}

body.is-mobile .composer-source-cite.is-open .composer-source-cite__row {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 0.32s var(--cite-open-ease) 0.07s,
    transform 0.4s var(--cite-open-spring) 0.05s;
}

body.is-mobile .composer-source-cite__mark {
  transform: scale(0.78);
  transition: transform 0.22s var(--cite-close-ease);
}

body.is-mobile .composer-source-cite.is-open .composer-source-cite__mark {
  transform: scale(1);
  transition: transform 0.42s var(--cite-open-spring) 0.1s;
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile .composer-source-cite,
  body.is-mobile .composer-source-cite.is-open,
  body.is-mobile .composer-source-cite__row,
  body.is-mobile .composer-source-cite.is-open .composer-source-cite__row,
  body.is-mobile .composer-source-cite__mark,
  body.is-mobile .composer-source-cite.is-open .composer-source-cite__mark {
    transition: none !important;
    transform: none;
  }
}

body.is-mobile .chat-history-loading {
  padding: 16px;
}

body.is-mobile .chat-history-loading__spinner {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

body.is-mobile .welcome-state {
  gap: 2px;
  padding: 12px;
}

body.is-mobile .welcome-prompt {
  max-width: min(24rem, 94vw);
  margin-top: 2px;
}

body.is-mobile .welcome-prompt__line {
  font-size: 17px;
  letter-spacing: -0.01em;
  line-height: 1.42;
}

body.is-mobile .welcome-globe-mount {
  margin-bottom: 0;
  transform: none;
}

body.is-mobile .welcome-globe {
  font-size: 4.35px;
  opacity: 0.88;
}

body.is-mobile .composer {
  position: relative;
  z-index: 20;
  padding:
    6px 10px
    calc(
      6px + max(
        0px,
        var(--mobile-safe-bottom) - min(var(--mobile-safe-bottom), var(--mobile-keyboard-inset))
      )
    );
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

body.is-mobile .composer-card {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  /* Slightly lower top edge only — keep side/bottom padding and inner control geometry. */
  padding: 6px 12px 9px;
  border-radius: 16px;
  background: var(--sw-bg-main);
  box-shadow: none;
}

body.is-mobile .composer-card:focus-within {
  transform: none;
  background: var(--sw-bg-main);
  box-shadow: none;
}

body.is-mobile .composer-card__input,
body.is-mobile .composer-ph {
  /* Keep ?16px to avoid iOS focus zoom. */
  font-family: var(--sw-font);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
  font-weight: 400;
}

body.is-mobile .composer-card__input {
  min-height: 40px;
  max-height: 120px;
  padding: 6px 2px 8px;
  font-family: var(--sw-font);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.45;
}

body.is-mobile .composer-ph {
  top: 6px;
  font-size: 16px;
}

body.is-mobile .composer-ph__line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Keep native placeholder readable on mobile when roll stage is off */
body.is-mobile .composer-card:not([data-ph-roll="true"]) .composer-card__input::placeholder {
  color: rgba(255, 255, 255, 0.42);
  opacity: 1;
}

body.is-mobile .composer-card__toolbar {
  gap: 6px;
  min-height: 40px;
  align-items: center;
}

/* Attach expand: height via --attach-h; open soft, close measured */
body.is-mobile .composer-attach-sheet {
  display: block;
  height: 0;
  overflow: hidden;
  --attach-h: 0px;
}

body.is-mobile .composer-card.is-attach-open .composer-attach-sheet {
  height: var(--attach-h, 272px);
}

body.is-mobile .composer-attach-sheet.is-height-open {
  transition: height 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-mobile .composer-attach-sheet.is-height-close {
  transition: height 280ms cubic-bezier(0.33, 0, 0.2, 1);
}

body.is-mobile .composer-attach-sheet.is-height-anim {
  transition: height 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-mobile .composer-attach-sheet.is-dragging {
  transition: none !important;
}

body.is-mobile .composer-card.is-attach-open {
  background: rgba(16, 16, 18, 0.78);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035) inset;
  transform: none;
}

body.is-mobile .composer-attach-sheet__body {
  border-top: 0;
  gap: 4px;
}

body.is-mobile .composer-attach-island {
  max-width: fit-content;
  width: fit-content;
  padding: 0 4px;
  margin: 0 auto;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

body.is-mobile .composer-attach-cats {
  margin: 0;
  gap: 14px;
  padding: 0 2px;
  background: transparent !important;
  box-shadow: none !important;
}

body.is-mobile .composer-attach-cat {
  font-family: var(--sw-font);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  padding: 2px 2px 5px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.is-mobile .composer-attach-pane--photos {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: 8px;
  padding-right: 8px;
}

body.is-mobile .composer-attach-pane--files {
  padding-left: 8px;
  padding-right: 8px;
}

body.is-mobile .composer-attach-sheet__handle {
  display: none !important;
}

body.is-mobile .composer-attach-sheet__handle-bar {
  display: none !important;
}

body.is-mobile .tg-file--pick {
  margin-bottom: 2px;
}

body.is-mobile .tg-file--pick .tg-file__name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

body.is-mobile .tg-file--uploaded,
body.is-mobile .tg-file--plain {
  padding-left: 10px;
  padding-right: 2px;
}

body.is-mobile .tg-file__delete {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 24px;
  font-weight: 400;
  border-radius: 10px;
}

body.is-mobile .tg-file__delete:hover,
body.is-mobile .tg-file__delete:active {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
}

body.is-mobile .tg-files-sep {
  margin: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
}

body.is-mobile .composer-tool--attach {
  background: var(--tool-bg, rgba(255, 255, 255, 0.05));
  color: var(--tool-fg);
  display: inline-grid !important;
  place-items: center;
  place-content: center;
  padding: 0 !important;
}

body.is-mobile .composer-tool--attach .composer-tool__glyph {
  width: 100% !important;
  height: 100% !important;
  display: grid !important;
  place-items: center;
}

body.is-mobile .composer-tool--attach .composer-tool__icon {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
}

body.is-mobile .composer-tool--attach.is-open {
  background: var(--tool-bg, rgba(255, 255, 255, 0.05));
  color: var(--tool-fg);
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile .composer-attach-sheet,
  body.is-mobile .composer-attach-sheet.is-height-anim,
  body.is-mobile .composer-attach-sheet.is-height-open,
  body.is-mobile .composer-attach-sheet.is-height-close,
  body.is-mobile .composer-attach-sheet__body,
  body.is-mobile .composer-attach-sheet__track,
  body.is-mobile .composer-tool--attach {
    transition: none !important;
    animation: none !important;
  }
}

body.is-mobile .composer-tools {
  gap: 5px;
  align-items: center;
}

/* Mode chips - expandable; send is a pure centered square (separate rules below) */
body.is-mobile .composer-tool {
  --tool-size: var(--mobile-ctrl);
  /* (44 - 20) / 2 — keeps 20px icon centered in the idle square */
  --tool-pad-x: 12px;
  min-width: var(--tool-size);
  min-height: var(--tool-size);
  height: var(--tool-size);
  max-height: var(--tool-size);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  align-items: center;
  justify-content: flex-start;
  padding: 0 var(--tool-pad-x);
}

body.is-mobile .composer-tool.is-active {
  padding-left: var(--tool-pad-x);
  padding-right: 12px;
}

body.is-mobile .composer-tool--attach {
  width: var(--tool-size);
  max-width: var(--tool-size);
  flex: 0 0 var(--tool-size);
  padding: 0;
  justify-content: center;
  place-items: center;
  box-sizing: border-box;
}

/* Send / stop - fixed square, glyph dead-center (do not share tool flex padding) */
body.is-mobile .composer-send,
body.is-mobile .composer-send.is-stop,
body.is-mobile .composer-send.is-stop:hover,
body.is-mobile .composer-send.is-stop:active {
  --tool-size: var(--mobile-ctrl);
  display: grid !important;
  place-items: center !important;
  place-content: center !important;
  align-content: center !important;
  justify-content: center !important;
  width: var(--tool-size);
  height: var(--tool-size);
  min-width: var(--tool-size);
  min-height: var(--tool-size);
  max-width: var(--tool-size);
  max-height: var(--tool-size);
  flex: 0 0 var(--tool-size);
  margin: 0;
  padding: 0 !important;
  border-radius: 11px;
  box-sizing: border-box;
  line-height: 0;
  box-shadow: none;
  animation: none;
  filter: none;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Stop surface only — bare mic/send stays transparent. */
body.is-mobile .composer-send.is-stop,
body.is-mobile .composer-send.is-stop:hover,
body.is-mobile .composer-send.is-stop:active {
  background: #ffffff;
  background-color: #ffffff;
  color: #111111;
}

body.is-mobile .composer-send.is-stop:hover {
  background: #f4f4f4;
  background-color: #f4f4f4;
}

body.is-mobile .composer-send.is-stop:active {
  background: #e6e6e6;
  background-color: #e6e6e6;
}

body.is-mobile .composer-send-icon {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  place-content: center !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0;
}

body.is-mobile .composer-send-arrow,
body.is-mobile .composer-send-plane,
body.is-mobile .composer-send-stop,
body.is-mobile .composer-send-voice {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  flex-shrink: 0;
}

body.is-mobile .composer-tool__glyph {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 20px !important;
  height: 20px !important;
  line-height: 0;
  flex: 0 0 20px;
}

body.is-mobile .composer-tool__icon {
  display: block;
  width: 20px !important;
  height: 20px !important;
  margin: 0;
  flex-shrink: 0;
}

body.is-mobile .composer-tool__rail,
body.is-mobile .composer-tool__slot,
body.is-mobile .composer-tool__label {
  height: 20px;
  max-height: 20px;
  line-height: 20px;
}

body.is-mobile .composer-tool.is-active .composer-tool__slot {
  padding-left: 6px;
}

body.is-mobile .composer-tool__label {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: none;
}

body.is-mobile .composer-mode-hint {
  display: none;
}

body.is-mobile .resize-handle,
body.is-mobile .btn-toggle-view,
body.is-mobile .btn-expand-strip {
  display: none !important;
}

body.is-mobile #win-sidebar,
body.is-mobile #win-docs,
body.is-mobile #win-calibration:not([hidden]) {
  position: fixed;
  z-index: 720;
  display: flex !important;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  font-size: var(--mobile-font);
  background: var(--sw-bg-main) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
  transition:
    transform var(--mobile-motion-dur) var(--mobile-motion-ease),
    opacity var(--mobile-motion-dur) var(--mobile-motion-ease),
    visibility 0s linear var(--mobile-motion-dur) !important;
}

body.is-mobile #win-sidebar {
  inset: 0;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: var(--mobile-viewport-height);
  padding-top: var(--mobile-safe-top);
  padding-bottom: var(--mobile-safe-bottom);
  background: var(--sw-bg-main) !important;
  border: 0 !important;
  border-color: transparent !important;
  border-radius: 0 !important;
  box-shadow: none;
  transform: translate3d(-104%, 0, 0);
}

/* Full-screen chats drawer: allow vertical list scroll; swipe-left handled in JS. */
body.is-mobile.mobile-panel-open[data-mobile-panel="sidebar"] #win-sidebar {
  touch-action: pan-y;
}

body.is-mobile #win-docs,
body.is-mobile #win-calibration:not([hidden]) {
  inset: auto 0 0;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: min(52dvh, 430px) !important;
  min-height: 220px;
  max-height: calc(var(--mobile-viewport-height) - var(--mobile-safe-top) - 64px);
  padding-bottom: var(--mobile-safe-bottom);
  border-radius: 14px 14px 0 0 !important;
  transform: translate3d(0, 104%, 0);
}

body.is-mobile #win-sidebar.is-mobile-open,
body.is-mobile #win-docs.is-mobile-open,
body.is-mobile #win-calibration.is-mobile-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  transition:
    transform var(--mobile-motion-dur) var(--mobile-motion-ease),
    opacity var(--mobile-motion-dur) var(--mobile-motion-ease),
    visibility 0s linear 0s !important;
}

body.is-mobile #win-calibration.calibration-retracted {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  border-width: 1px 1px 0 !important;
}

body.is-mobile #win-sidebar.window-collapsed,
body.is-mobile #win-docs.window-collapsed,
body.is-mobile #win-calibration.window-collapsed {
  min-width: 0;
}

body.is-mobile #win-sidebar .window-body,
body.is-mobile #win-docs .window-body,
body.is-mobile #win-calibration .window-body {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  padding-top: 2px;
}

body.is-mobile #win-sidebar .window-header,
body.is-mobile #win-docs .window-header,
body.is-mobile #win-calibration .window-header {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 2px 8px 0 10px;
  background: transparent;
  border-bottom: 0;
}

body.is-mobile #win-docs .window-header {
  min-height: 28px;
  padding: 2px 8px 0;
}

body.is-mobile #win-sidebar .window-title,
body.is-mobile #win-docs .window-title,
body.is-mobile #win-calibration .window-title,
body.is-mobile .sessions-label,
body.is-mobile .docs-heading {
  display: none !important;
}

body.is-mobile #win-sidebar .window-controls,
body.is-mobile #win-docs .window-controls,
body.is-mobile #win-calibration .window-controls {
  display: flex;
  margin-left: auto;
}

body.is-mobile .docs-sub {
  font-size: var(--mobile-font-xs);
  margin: 0 0 6px;
  line-height: 1.35;
}

body.is-mobile #win-docs .docs-sub {
  display: none !important;
}

body.is-mobile #win-docs .docs-mobile-masthead {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 2px;
  margin: 0 0 8px;
}

body.is-mobile #win-docs .docs-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 2px 0 8px;
}

body.is-mobile #win-docs .docs-sheet-handle__bar {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

body.is-mobile #win-docs .docs-mobile-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

body.is-mobile #win-docs .docs-mobile-title {
  margin: 0;
  color: var(--sw-text-main);
  font-family: var(--sw-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

body.is-mobile #win-docs .docs-count-badge {
  flex: 0 0 auto;
  min-width: 1.4em;
  color: var(--sw-text-muted);
  font: 600 11px/1.2 var(--sw-font-ui, var(--sw-font));
  letter-spacing: 0;
  opacity: 0.72;
  text-align: right;
}

body.is-mobile #win-docs .docs-mobile-sub {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  opacity: 0.55;
}

body.is-mobile #sync-status,
body.is-mobile .sync-status {
  display: none !important;
}

body.is-mobile #win-docs .window-header {
  min-height: 22px !important;
  padding: 2px 8px 0 !important;
}

body.is-mobile #win-docs .window-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 12px 10px;
  margin-top: -2px;
  overflow: hidden;
}

body.is-mobile #win-docs .docs-sub,
body.is-mobile #win-docs .docs-mobile-masthead,
body.is-mobile #win-docs .docs-toolbar,
body.is-mobile #win-docs .docs-upload-status {
  flex: 0 0 auto;
}

body.is-mobile #win-docs .docs-sub {
  margin: -2px 0 4px;
}

body.is-mobile .docs-toolbar {
  margin: 2px 0 8px;
  gap: 8px;
}

body.is-mobile #win-docs .docs-compare-btn {
  display: inline-flex;
  flex: 1 1 auto;
  justify-content: center;
  min-height: 38px;
}

body.is-mobile #win-docs .docs-upload-btn {
  flex: 1 1 auto;
  justify-content: center;
  min-height: 38px;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

body.is-mobile #win-docs .docs-upload-btn:hover:not(:disabled),
body.is-mobile #win-docs .docs-upload-btn:active:not(:disabled) {
  border-color: rgba(var(--accent-rgb), 0.45);
  color: var(--sw-text-main);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

/* Documents list: touch scroll, no visible scrollbar */
body.is-mobile #win-docs #docs-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.025);
}

body.is-mobile #win-docs #docs-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body.is-mobile #win-docs .docs-empty {
  margin: 18px 4px 8px;
  padding: 0;
  color: var(--sw-text-muted);
  font-size: 12.5px;
  line-height: 1.4;
  opacity: 0.7;
}

body.is-mobile #win-docs .doc-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 11px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0;
  transition: background 0.18s ease;
}

body.is-mobile #win-docs .doc-item:last-child {
  border-bottom: 0;
}

body.is-mobile #win-docs .doc-item-icon {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.62);
  font: 700 8px/1 var(--sw-font-ui, var(--sw-font));
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.is-mobile #win-docs .doc-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

body.is-mobile #win-docs .doc-item-head {
  margin: 0;
  align-items: center;
  gap: 10px;
}

body.is-mobile #win-docs .doc-item-head strong {
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--sw-text-main);
}

body.is-mobile #win-docs .doc-item-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  opacity: 0.55;
}

body.is-mobile #win-docs .doc-delete-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin: 0;
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  font-size: 22px;
  font-weight: 400;
  border-radius: 10px;
}

body.is-mobile #win-docs .doc-delete-btn:hover,
body.is-mobile #win-docs .doc-delete-btn:active {
  border-color: rgba(198, 40, 40, 0.35);
  color: #e57373;
  background: rgba(198, 40, 40, 0.12);
  box-shadow: none;
}

body.is-mobile .mobile-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: block;
  border: 0;
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity var(--mobile-motion-dur) var(--mobile-motion-ease);
}

body.is-mobile .mobile-panel-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

body.is-mobile #win-sidebar .window-header {
  position: absolute;
  top: var(--mobile-safe-top);
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: auto;
  min-height: 0 !important;
  padding: 10px 8px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body.is-mobile #win-sidebar .window-body {
  padding-top: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.is-mobile .sidebar-header {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 18px 48px 10px 16px;
  border-bottom: 0;
}

body.is-mobile .sidebar-brand-title {
  display: block;
  min-height: 0;
  padding: 0;
  font-family: "Syne", var(--sw-font);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  text-align: left;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.is-mobile .sidebar-actions {
  padding: 4px 14px 10px;
  margin-bottom: 0;
}

body.is-mobile .new-chat-btn {
  font-family: var(--sw-font);
  font-size: 14px;
  font-weight: 500;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 10px !important;
}

body.is-mobile .sessions-label {
  display: block !important;
  padding: 14px 16px 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.36);
}

body.is-mobile #sessions-list {
  padding: 2px 10px 12px;
}

/* Sessions → footer veil: fully transparent on mobile (no white wash). */
body.is-mobile #win-sidebar.sw-rail #sessions-list::after {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  -webkit-mask-image: none;
  mask-image: none;
  opacity: 0;
}

body.is-mobile .session-item {
  min-height: 46px;
  padding: 10px 8px 10px 14px;
  margin-bottom: 0;
  font-family: var(--sw-font);
  font-size: 14.5px;
  letter-spacing: 0;
  line-height: 1.35;
  border-radius: 0;
  border-bottom: 0;
}

body.is-mobile .session-item.active,
body.is-mobile .session-item.session-activating {
  border-radius: 10px;
}

body.is-mobile .session-actions {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

body.is-mobile .session-rename,
body.is-mobile .session-delete,
body.is-mobile .session-pin {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px !important;
  min-width: 38px;
  height: 38px !important;
  min-height: 38px;
  padding: 0;
  border-radius: 9px;
  font-size: 15px !important;
  line-height: 1;
  opacity: 0.78;
}

body.is-mobile .session-delete {
  font-size: 19px !important;
}

body.is-mobile .session-pin.is-on {
  opacity: 0.95;
}

body.is-mobile .sidebar-footer {
  padding: 10px 10px max(14px, var(--mobile-safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

body.is-mobile .sidebar-util-row {
  display: flex;
  gap: 6px;
}

body.is-mobile .sidebar-util-btn {
  flex: 1 1 0;
  min-height: 42px;
  padding: 9px 4px;
  font-family: var(--sw-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.68);
}

body.is-mobile .sidebar-util-btn:hover:not(:disabled),
body.is-mobile .sidebar-util-btn:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.94);
}

body.is-mobile .sidebar-util-label {
  display: none;
}

body.is-mobile .sidebar-util-icon {
  width: 18px;
  height: 18px;
}

body.is-mobile .sidebar-util-icon svg {
  width: 18px;
  height: 18px;
}

body.is-mobile .sessions-empty {
  padding: 16px 12px;
  font-size: 12.5px;
  text-align: left;
}

body.is-mobile .docs-upload-btn,
body.is-mobile .docs-compare-btn,
body.is-mobile .calib-toggle {
  min-height: 36px;
  font-size: var(--mobile-font-sm);
}

body.is-mobile .calib-label,
body.is-mobile .calib-toggle-name,
body.is-mobile .calib-toggle-hint,
body.is-mobile .calib-diagram-label {
  font-size: var(--mobile-font-xs);
}

body.is-mobile .session-modal-overlay {
  align-items: flex-end;
  padding:
    12px
    max(6px, var(--mobile-safe-right))
    0
    max(6px, var(--mobile-safe-left));
  background: rgba(0, 0, 0, 0.52);
}

body.is-mobile .session-modal {
  width: 100%;
  max-width: none;
  max-height: calc(var(--mobile-viewport-height) - var(--mobile-safe-top) - 36px);
  margin: 0;
  padding-bottom: var(--mobile-safe-bottom);
  border-radius: 18px 18px 0 0 !important;
  overflow-y: auto;
  font-size: var(--mobile-font);
  background: rgba(16, 14, 22, 0.98) !important;
}

/* Rename sheet: full slide from bottom */
body.is-mobile .rename-session-overlay .rename-modal {
  animation: rename-sheet-in var(--session-modal-dur, 0.48s) var(--session-modal-ease, cubic-bezier(0.16, 1, 0.3, 1)) both;
  will-change: transform;
}

body.is-mobile .rename-session-overlay.is-closing .rename-modal {
  animation: rename-sheet-out var(--session-modal-dur, 0.48s) var(--session-modal-ease, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

@keyframes rename-sheet-in {
  from {
    opacity: 1;
    transform: translate3d(0, 100%, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes rename-sheet-out {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 100%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile .rename-session-overlay .rename-modal,
  body.is-mobile .rename-session-overlay.is-closing .rename-modal {
    animation-duration: 0.01ms !important;
  }
}

body.is-mobile .session-modal .window-title,
body.is-mobile .delete-modal-lead,
body.is-mobile .delete-modal-hint,
body.is-mobile .rename-modal-body label {
  font-size: var(--mobile-font-sm);
}

body.is-mobile .rename-modal-handle {
  display: block;
  width: 36px;
  height: 4px;
  margin: 10px auto 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

body.is-mobile .rename-modal-head {
  padding: 8px 16px 4px !important;
  border-bottom: 0 !important;
}

body.is-mobile .rename-modal-head .window-title {
  font-size: 16px !important;
  color: var(--sw-text-main) !important;
}

body.is-mobile .rename-modal-body {
  padding: 4px 16px 18px;
}

body.is-mobile .rename-modal-label {
  margin-bottom: 8px;
  font-size: 10px;
}

body.is-mobile .rename-modal-input,
body.is-mobile .rename-modal-body input {
  margin-bottom: 14px;
  padding: 14px 15px;
  font-size: 16px;
  border-radius: 14px;
}

body.is-mobile .rename-modal-actions {
  gap: 8px;
}

/* Marker feed on mobile */
body.is-mobile .agent-live-feed {
  --alf-row-gap: 12px;
  --alf-font-size: 14.5px;
  width: min(100%, 100%);
  max-width: 100%;
  padding-bottom: 10px;
}

body.is-mobile .agent-live-feed__shell {
  gap: var(--alf-row-gap);
}

body.is-mobile .agent-live-feed__tools,
body.is-mobile .agent-live-feed__think-steps {
  gap: var(--alf-row-gap);
}

body.is-mobile .sw-marker,
body.is-mobile .agent-live-feed__think-step,
body.is-mobile .agent-live-feed__tool {
  font-size: var(--alf-font-size);
  gap: 10px;
}

body.is-mobile .sw-marker__icon {
  width: 18px;
  height: 18px;
}

body.is-mobile .sw-marker__icon svg {
  width: 18px;
  height: 18px;
}

body.is-mobile .agent-live-feed__thinking .sw-marker__icon,
body.is-mobile .sw-marker__icon--spin-sm {
  width: 18px;
  height: 18px;
}

body.is-mobile .agent-live-feed__thinking .sw-marker__icon svg,
body.is-mobile .sw-marker__icon--spin-sm svg {
  width: 12px;
  height: 12px;
}

body.is-mobile .agent-live-feed__think-fork {
  margin-left: 0;
}

body.is-mobile .agent-live-feed__fork-steps > .agent-live-feed__step.is-fork-step {
  grid-template-columns: 18px 1fr;
  column-gap: 12px;
}

body.is-mobile .agent-live-feed__fork-steps > .agent-live-feed__step.is-fork-step > .agent-live-feed__rail {
  width: 18px;
}

body.is-mobile .sw-marker--separator,
body.is-mobile .agent-live-feed__tools-sep {
  font-size: 12.5px;
}

body.is-mobile .agent-live-feed__tools-sep::before,
body.is-mobile .agent-live-feed__tools-sep::after {
  min-width: 48px;
}

body.is-mobile .agent-live-feed__step {
  grid-template-columns: 10px 1fr;
  column-gap: 7px;
  padding-bottom: 9px;
}

body.is-mobile .agent-live-feed__mark {
  width: 5px;
  height: 5px;
  margin-top: 3px;
}

body.is-mobile .agent-live-feed__step-label {
  font-size: 10px;
}

body.is-mobile .agent-live-feed__step-text {
  font-size: 12px;
  line-height: 1.35;
}

body.is-mobile .thought-chain {
  max-width: 100%;
  border-radius: 9px;
}

body.is-mobile .thought-chain-toggle {
  padding: 6px 10px;
  font-size: 11.5px;
}

body.is-mobile .msg.thought .thought-body {
  padding: 5px 2px;
  font-size: 12px;
  gap: 8px;
}

body.is-mobile .msg.thought .thought-loader,
body.is-mobile .msg.thought .thought-done-icon {
  width: 12px;
  height: 12px;
}


/* Chat markdown tables — scroll sideways inside wrap only (never widen the chat). */
body.is-mobile .msg.assistant {
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

body.is-mobile .msg.assistant .msg-body .msg-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 12px 0 14px;
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

/* Soft-round horizontal table scrollbar ends on mobile. */
body.is-mobile .msg.assistant .msg-body .msg-table-wrap::-webkit-scrollbar {
  height: 5px;
}

body.is-mobile .msg.assistant .msg-body .msg-table-wrap::-webkit-scrollbar-track {
  background: transparent;
  margin: 0 18px;
  border-radius: 999px;
}

body.is-mobile .msg.assistant .msg-body .msg-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 1.5px solid transparent;
  background-clip: padding-box;
}

body.is-mobile .msg.assistant .msg-body .msg-table-wrap::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

body.is-mobile .msg.assistant .msg-body .msg-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 14px;
  line-height: 1.45;
}

body.is-mobile .msg.assistant .msg-body .msg-table th,
body.is-mobile .msg.assistant .msg-body .msg-table td {
  padding: 10px 12px;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

body.is-mobile .msg.assistant .msg-body .msg-table thead th {
  padding: 11px 12px;
  font-size: 13px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

body.is-mobile .msg.assistant .msg-body .msg-table tbody tr:hover td {
  background: transparent;
}

@media (max-width: 430px) {
  body.is-mobile {
    --mobile-ctrl: 36px;
    --mobile-header-height: 48px;
  }

  body.is-mobile .msg.assistant .msg-body .msg-table {
    font-size: 13.5px;
    line-height: 1.42;
  }

  body.is-mobile .msg.assistant .msg-body .msg-table th,
  body.is-mobile .msg.assistant .msg-body .msg-table td {
    padding: 9px 11px;
  }

  body.is-mobile .msg.assistant .msg-body .msg-table thead th {
    padding: 10px 11px;
    font-size: 12.5px;
  }

  body.is-mobile .mobile-chat-header {
    gap: 4px;
    padding-right: 6px;
    padding-left: 6px;
  }

  body.is-mobile .mobile-chat-header__title {
    padding: 0 calc(var(--mobile-ctrl) + 12px) 0 calc(var(--mobile-ctrl) * 2 + 16px);
    font-size: 13.5px;
  }

  body.is-mobile .composer-tool {
    --tool-size: var(--mobile-ctrl);
    --tool-pad-x: 8px;
    font-size: 11.5px;
  }

  body.is-mobile .composer-send,
  body.is-mobile .composer-send.is-stop {
    --tool-size: var(--mobile-ctrl);
  }

  body.is-mobile .composer-tool__glyph,
  body.is-mobile .composer-tool__icon {
    width: 18px !important;
    height: 18px !important;
  }

  body.is-mobile .composer-tool__glyph {
    flex-basis: 18px;
  }

  body.is-mobile .composer-tool__label {
    font-size: 11.5px;
  }

  body.is-mobile .composer-tool.is-active {
    padding-right: 10px;
  }

  body.is-mobile .composer-tool.is-active .composer-tool__slot {
    padding-left: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile #win-sidebar,
  body.is-mobile #win-docs,
  body.is-mobile #win-calibration,
  body.is-mobile .mobile-panel-backdrop {
    transition: none !important;
  }
}
