/* Compact phone views. Desktop/Electron keeps its original layout and panels. */
.mobile-only {
  display: none;
}
html.mobile {
  height: 100%;
  overflow: hidden;
}
html.mobile body {
  position: fixed;
  top: var(--mobile-top, 0px);
  left: 0;
  width: 100%;
  height: var(--mobile-height, 100dvh);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
html.mobile.mobile-keyboard body {
  padding-bottom: 0;
}
html.mobile .mobile-only {
  display: flex;
}
html.mobile body > nav,
html.mobile #browserPaneHost,
html.mobile #cliPaneHost,
html.mobile #chatPaneHost,
html.mobile #figmaHost,
html.mobile #graphPane,
html.mobile #gpResizer,
html.mobile #usagePop,
html.mobile #calAlarms,
html.mobile #skAlarms,
html.mobile #phaseTabs [data-f="rt"] {
  display: none !important;
}
html.mobile #mobileHeader {
  align-items: center;
  gap: 10px;
  flex: 0 0 60px;
  padding: 6px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
html.mobile #mobileHeader button {
  height: 44px;
  min-width: 44px;
  border: 0;
  background: transparent;
}
html.mobile #mobileBack {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  font-size: 28px;
}
html.mobile #mobileBack span {
  font-size: 14px;
  font-weight: 600;
}
html.mobile #mobileHelp {
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 18px;
}
html.mobile .mobile-heading {
  flex: 1;
  min-width: 0;
}
html.mobile .mobile-heading strong {
  font-size: 19px;
  letter-spacing: -0.5px;
}
html.mobile .mobile-heading strong span {
  margin-left: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
}
html.mobile .mobile-heading small {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-size: 11px;
}
html.mobile .body-row,
html.mobile #main {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
html.mobile .sidebar {
  width: 100%;
  min-width: 0;
  border: 0;
}
html.mobile .sidebar .newbox {
  padding: 16px;
  gap: 10px;
}
html.mobile .sidebar .newbox button {
  min-height: 44px;
  font-size: 14px;
}
html.mobile .mobile-search {
  padding: 0 16px 8px;
  margin-top: 12px;
}
html.mobile #mobileSessionSearch {
  width: 100%;
  min-height: 44px;
  background: var(--panel2);
  border: 0;
  border-radius: 12px;
}
html.mobile #phaseTabs {
  margin: 4px 16px 8px !important;
}
html.mobile #phaseTabs button {
  min-height: 44px;
  font-size: 14px;
}
html.mobile #slist {
  padding: 0 8px 16px;
  overscroll-behavior-y: contain;
}
html.mobile .sitem {
  padding: 16px 12px;
  border-radius: 12px;
  margin: 2px 0;
}
html.mobile .sitem .sn {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}
html.mobile .sitem .sm {
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
html.mobile .sitem .shold {
  opacity: 1;
}
/* 터치 기기엔 hover 가 없다 — 통합 목록의 버튼도 흐름에 그대로 두고 항상 보인다 */
html.mobile .sitem .sacts {
  position: static;
  transform: none;
  /* 아이콘 두 개(44px) + 간격 자리를 늘 비워둬야 삭제 버튼 유무로 시각 열이 밀리지 않는다 */
  min-width: calc(44px * 2 + 6px);
  justify-content: flex-end;
}
html.mobile .sitem .sacts .sdel {
  opacity: 1;
  pointer-events: auto;
}
html.mobile .sitem .iconbtn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
html.mobile #sessMain {
  display: none;
  min-height: 0;
}
html.mobile.mobile-chat .sidebar {
  display: none;
}
html.mobile.mobile-chat #sessMain {
  display: flex;
  width: 100%;
}
html.mobile .sess-header {
  padding: 10px 16px;
  gap: 8px;
  min-height: 48px;
}
html.mobile .sess-header .title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.mobile .sess-header .spacer,
html.mobile #sessSub,
html.mobile #sessBg,
html.mobile #sessCtx,
html.mobile #btnToRT,
html.mobile #btnReview,
html.mobile #btnGraph,
html.mobile #btnMakePR {
  display: none !important;
}
html.mobile .sess-header .badge {
  flex-shrink: 0;
  font-size: 11px;
}
html.mobile .sess-body,
html.mobile #chatWrap {
  min-width: 0;
  min-height: 0;
  width: 100%;
}
html.mobile .chat-nav {
  min-height: 44px;
  padding: 0 12px;
}
html.mobile .chat-nav button {
  min-width: 44px;
  min-height: 44px;
}
html.mobile .chat-nav-title,
html.mobile #chatPrevPrompt,
html.mobile #chatNextPrompt {
  display: none;
}
html.mobile .chat-col {
  padding: 0 16px;
}
html.mobile .chat-msgs {
  overscroll-behavior-y: contain;
}
html.mobile .chat-msg {
  max-width: 100%;
  overflow-wrap: anywhere;
}
html.mobile .chat-msg.user {
  margin-top: 20px;
}
html.mobile .chat-msg .md-body {
  font-size: 15px;
  line-height: 1.7;
}
html.mobile .chat-inputbar {
  padding: 8px 10px;
}
html.mobile .chat-inputbar .inner {
  padding: 6px;
  gap: 2px;
  border-radius: 18px;
}
html.mobile .chat-inputbar textarea {
  font-size: 16px;
  min-height: calc(1.5em + 16px);
  max-height: min(160px, 25dvh);
  padding: 8px;
}
html.mobile input,
html.mobile select,
html.mobile textarea {
  font-size: 16px;
}
html.mobile .chat-inputbar .inrow {
  gap: 2px;
}
html.mobile .chat-inputbar .inrow button {
  height: 44px;
}
html.mobile .chat-inputbar .composer-icon,
html.mobile .chat-inputbar #chatSend {
  width: 44px;
  min-width: 44px;
}
html.mobile #chatShot,
html.mobile #chatHold,
html.mobile .chat-send-label {
  display: none;
}
html.mobile .chat-inputbar .chat-model {
  max-width: 148px;
  font-size: 12px;
  padding: 0 8px;
}
html.mobile .model-pick {
  flex-shrink: 1;
  min-width: 0;
}
html.mobile .chat-inputbar .mp-menu {
  left: -46px;
  right: auto;
  width: min(350px, calc(100vw - 32px));
  max-height: min(360px, calc(var(--mobile-height, 100dvh) - 180px));
  overflow-y: auto;
}
html.mobile .mp-row .mp-main {
  min-height: 44px;
}
html.mobile .chat-inputbar .mp-row .mp-eff {
  min-height: 36px;
}
html.mobile .slash-menu {
  max-height: min(240px, 35dvh);
}
html.mobile .slash-menu .sm-item {
  min-height: 44px;
  align-items: center;
}
html.mobile .chat-find-row {
  flex-wrap: wrap;
}
html.mobile #chatFindInput {
  flex: 1 1 100%;
  min-height: 44px;
}
html.mobile .chat-find-row button {
  min-width: 44px;
  min-height: 44px;
}
html.mobile .perm-actions {
  flex-wrap: wrap;
}
html.mobile .perm-actions button,
html.mobile .ask-card button {
  min-height: 44px;
}
html.mobile .perm-always {
  flex-basis: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
}
html.mobile .perm-in,
html.mobile .tool-out {
  overflow-x: auto;
  max-width: 100%;
}
html.mobile .modal-overlay {
  top: var(--mobile-top, 0px);
  bottom: auto;
  height: var(--mobile-height, 100dvh);
  padding: 12px;
}
html.mobile .modal {
  width: 100% !important;
  max-width: 480px !important;
  max-height: calc(var(--mobile-height, 100dvh) - 32px);
  overflow-y: auto;
  padding: 18px;
}
html.mobile .modal button {
  min-height: 44px;
}
html.mobile .modal .m-actions {
  flex-wrap: wrap;
}
html.mobile #askBar {
  padding: 6px 12px;
  max-height: 88px;
  overflow: auto;
  flex-shrink: 0;
}
html.mobile #askBar button {
  min-height: 44px;
}
html.mobile #loginBar {
  flex-wrap: wrap;
  font-size: 12px !important;
}
html.mobile #loginBar button {
  min-height: 44px;
}
/* A locked desktop-only approval is informational here, never a phone-wide blocker. */
html.mobile #apvWrap {
  position: static;
  padding: 0;
  background: none;
  display: block;
  max-height: 120px;
  overflow-y: auto;
  flex-shrink: 0;
}
html.mobile #apvWrap[hidden] {
  display: none;
}
html.mobile #apvWrap .apv {
  border-radius: 0;
  padding: 10px 16px;
  width: 100%;
}
html.mobile .apv-cmd {
  max-height: 48px;
  overflow: auto;
}
html.mobile .apv-locked {
  font-size: 12px;
}
html.mobile .auth-screen {
  height: 100% !important;
  width: 100%;
  padding: 20px;
  overflow-y: auto;
}
html.mobile .auth-screen > div {
  width: 100%;
  max-width: 420px;
  padding: 28px 20px !important;
}
html.mobile .auth-screen a {
  min-height: 44px;
}
@media (max-height: 500px) {
  html.mobile #mobileHeader {
    flex-basis: 48px;
  }
  html.mobile .mobile-heading small,
  html.mobile .chat-nav {
    display: none;
  }
  html.mobile .sess-header {
    min-height: 36px;
    padding: 4px 12px;
  }
}
html.mobile #offlineBanner,
html.mobile #staleBanner {
  position: static !important;
  transform: none !important;
  width: 100%;
  max-height: 72px;
  overflow: auto;
  flex-shrink: 0;
  font-size: 11px !important;
}

/* Compact navigation: one 52px bar; all secondary destinations are opt-in. */
html.mobile #mobileHeader {
  flex: 0 0 52px;
  min-height: 52px;
  padding: 4px 8px;
  gap: 8px;
}
html.mobile #mobileBack[hidden] {
  display: none;
}
html.mobile #mobileTitle {
  display: block;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.25px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
html.mobile .mobile-heading {
  padding-left: 6px;
}
html.mobile #mobileConnection {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html.mobile #mobileMenuButton {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  flex-shrink: 0;
}
html.mobile #mobileStatus {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green, #39845c);
}
html.mobile #mobileStatus[data-state="offline"],
html.mobile #mobileStatus[data-state="connecting"] {
  background: #bd7610;
}
html.mobile #mobileStatus[data-state="busy"] {
  background: #bd7610;
}
html.mobile .sess-header,
html.mobile .chat-nav {
  display: none !important;
}
#mobileMenu {
  padding: 16px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: min(340px, calc(100vw - 24px));
  max-height: calc(var(--mobile-height, 100dvh) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}
#mobileMenu::backdrop {
  background: rgb(0 0 0 / 35%);
}
#mobileMenu button {
  min-height: 44px;
  font-size: 15px;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 10px;
  text-align: left;
}
#mobileMenu button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.mobile-menu-head button {
  min-width: 44px;
  text-align: center !important;
  font-size: 25px !important;
}
.mobile-menu-links {
  display: grid;
  gap: 4px;
}
.mobile-menu-links button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.mobile-menu-links button[aria-current="page"] {
  background: var(--panel2) !important;
  font-weight: 650;
}
#mobileChatActions {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
}
#mobileChatActions[hidden],
#mobileMenu button[hidden] {
  display: none;
}
#mobileChatActions small {
  padding: 0 12px 6px;
  color: var(--dim);
}
#mobileMenu #mobileHelp {
  font-size: 12px;
  color: var(--dim);
  margin-top: 10px;
  padding: 8px 12px;
  border: 0;
  width: 100%;
  border-radius: 10px;
}
/* The same existing views and APIs, stacked instead of squeezed side by side. */
html.mobile .page {
  min-width: 0;
  width: 100%;
  overflow: auto;
  padding: 16px;
}
html.mobile .content,
html.mobile .form-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
}
html.mobile #main > .home {
  width: 100%;
  min-width: 0;
  padding: 16px;
  overflow: auto;
}
html.mobile .pr-side {
  width: 100%;
  min-width: 0;
  flex: 1;
  border-right: 0;
}
html.mobile #prDetail {
  display: none;
}
html.mobile.mobile-git-detail .pr-side {
  display: none;
}
html.mobile.mobile-git-detail #prDetail {
  display: block;
}
html.mobile .pr-toolbar .row {
  flex-wrap: wrap;
}
html.mobile .pr-toolbar select {
  min-width: 0;
  max-width: 100%;
  flex: 1;
}
html.mobile .pr-toolbar button,
html.mobile .git-tab,
html.mobile .set-tab,
html.mobile .subtabs button,
html.mobile .cal-head button {
  min-height: 44px;
}
html.mobile #prDetail pre,
html.mobile #prDetail .diff {
  max-width: 100%;
  overflow-x: auto;
}
html.mobile .ont-head,
html.mobile .ont-controls {
  flex-wrap: wrap;
  gap: 10px;
}
html.mobile .ont-head h2 {
  font-size: 17px;
}
html.mobile .ont-mode {
  display: none;
}
html.mobile .ont-search {
  width: 100%;
  min-width: 0;
}
html.mobile .ont-body {
  display: block;
}
html.mobile #ontList {
  width: 100%;
  min-width: 0;
}
html.mobile .ont-fact,
html.mobile .ont-id,
html.mobile .ont-rels {
  overflow-wrap: anywhere;
}
html.mobile .ont-controls .subtabs {
  flex-basis: 100%;
  min-width: 0;
}
html.mobile .gcal-wrap {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
html.mobile .gcal-wrap > .card {
  width: 100%;
  min-width: 0;
}
html.mobile .cal-head {
  flex-wrap: wrap;
}
html.mobile .cal-head > .go {
  margin-left: auto;
  font-size: 11px;
}
html.mobile .set-tabs {
  max-width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
html.mobile .set-tabs .set-tab {
  flex-shrink: 0;
}
html.mobile .set-pane {
  overflow-wrap: anywhere;
}
html.mobile .set-pane .field {
  max-width: 100%;
  flex-wrap: wrap;
}
html.mobile .set-pane input,
html.mobile .set-pane select {
  min-width: 0;
  max-width: 100%;
}
html.mobile .set-pane button {
  min-height: 44px;
}
html.mobile .set-pane label {
  min-width: 0;
}
html.mobile .pal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
html.mobile .mobile-usage h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}
html.mobile #mobileUsageRefresh {
  min-height: 44px;
}
html.mobile #mobileUsageBody {
  margin-top: 16px;
}
html.mobile .cal-cell {
  min-height: 60px;
  padding: 0 2px 4px;
}
html.mobile .cal-ev {
  font-size: 10px;
  padding-left: 2px;
}
html.mobile .cal-ev .et {
  display: none;
}
html.mobile .gcal-wrap .card {
  padding: 12px;
}
html.mobile .pr-side {
  max-width: none;
}
html.mobile #mobileMenu {
  position: fixed;
  top: calc(var(--mobile-top, 0px) + max(12px, env(safe-area-inset-top)));
  right: max(12px, env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  margin: 0;
}
#mobileMenu button {
  line-height: 20px;
}

/* 폴더 선택 탐색기 — 탭 한 번으로 들어가므로 타깃을 손가락 크기로 */
html.mobile .db-row {
  padding: 12px;
  min-height: 44px;
  font-size: 14px;
}
html.mobile #dbPath {
  font-size: 16px; /* iOS 입력 포커스 시 자동 확대 방지 */
}
