/* 가상오피스 휴대폰 보정 (2026-10-11). 600px 이상(폴더블 펼침·PC)은 기존 배치 그대로. */
html.m-app body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
html.m-app header { padding-top: env(safe-area-inset-top); }
@media screen and (max-width: 1023px) {
  html.m-touch input:not([type=checkbox]):not([type=radio]):not([type=file]), html.m-touch textarea, html.m-touch select { font-size: 16px !important; }
}
#m-tabs { display: none; }

/* 일반 휴대폰(600px 미만): 한 번에 한 화면 + 아래 탭 3개 */
@media screen and (max-width: 599px) {
  :root { --m-head: 56px; --m-tab: calc(58px + env(safe-area-inset-bottom)); }
  html.m-phone body { overflow: hidden; }
  html.m-phone header { height: var(--m-head) !important; padding: 0 12px !important; }
  html.m-phone header .brand small, html.m-phone header .top-note { display: none !important; }
  html.m-phone header .mark { width: 32px; height: 32px; font-size: 17px; }
  html.m-phone header h1 { font-size: 15px !important; }
  html.m-phone header .scene-top { width: 52% !important; right: 10px !important; left: auto !important; transform: none !important; top: 9px !important; text-align: right !important; }
  html.m-phone header h2 { font-size: 13px !important; }
  html.m-phone header .scene-top p { font-size: 10px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  #m-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--m-tab); padding-bottom: env(safe-area-inset-bottom); z-index: 50; background: #fff; border-top: 1px solid #dde4df; box-shadow: 0 -3px 12px rgba(30,60,50,.07); }
  #m-tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: #617470; padding: 4px 0; }
  #m-tabs button i { font-style: normal; font-size: 19px; line-height: 1; }
  #m-tabs button[aria-pressed=true] { color: #276f60; font-weight: 700; background: #eaf2ee; }

  /* 공통: 세 화면 모두 헤더 아래 ~ 탭 위 영역을 꽉 채움 */
  html.m-phone .layout, html.m-phone #office-chat, html.m-phone #detail.right {
    position: fixed !important; top: var(--m-head) !important; bottom: var(--m-tab) !important; left: 0 !important; right: 0 !important;
    width: 100% !important; height: auto !important; max-height: none !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  }

  /* ① 업무 지시(채팅) */
  html.m-phone[data-m-tab=chat] .layout, html.m-phone[data-m-tab=chat] #detail.right { display: none !important; }
  html.m-phone[data-m-tab=chat] #office-chat { display: grid !important; grid-template-columns: minmax(0,1fr) 84px !important; grid-template-rows: 24px minmax(0,1fr) 76px auto !important; gap: 6px !important; padding: 8px 10px !important; z-index: 20; }
  html.m-phone[data-m-tab=chat] #office-chat > * { grid-column: 1 / -1; }
  html.m-phone[data-m-tab=chat] #job-history { grid-row: 2 !important; max-height: none !important; min-height: 0 !important; overflow: auto !important; }
  html.m-phone[data-m-tab=chat] #job-prompt { grid-row: 3 !important; grid-column: 1 !important; height: 100% !important; min-height: 0 !important; }
  html.m-phone[data-m-tab=chat] #job-send { grid-row: 3 !important; grid-column: 2 !important; height: 100% !important; padding: 4px !important; font-size: 13px !important; }
  html.m-phone[data-m-tab=chat] #job-message { grid-row: 4 !important; font-size: 11px; }
  html.m-phone[data-m-tab=chat] #attachment-bar { grid-row: 5 !important; flex-wrap: wrap; font-size: 11px; }
  html.m-phone[data-m-tab=chat] #office-chat { grid-template-rows: 24px minmax(0,1fr) 76px auto auto !important; }

  /* ② 사무실(3D) */
  html.m-phone[data-m-tab=office] #office-chat, html.m-phone[data-m-tab=office] #detail.right { display: none !important; }
  html.m-phone[data-m-tab=office] .layout { display: block !important; }
  html.m-phone[data-m-tab=office] .layout > .left { display: none !important; }
  html.m-phone[data-m-tab=office] main { position: absolute !important; inset: 0 !important; --summary-height: 150px; }
  html.m-phone[data-m-tab=office] main #viewport { left: 0 !important; right: 0 !important; top: 0 !important; bottom: var(--summary-height) !important; }
  html.m-phone[data-m-tab=office] main #work-summary { display: grid !important; left: 6px !important; right: 6px !important; bottom: 6px !important; top: auto !important; width: auto !important; height: calc(var(--summary-height) - 12px) !important; grid-template-columns: repeat(2, minmax(0,1fr)) !important; }

  /* ③ 에이전트(목록·접속현황 + 선택한 에이전트 정보) */
  html.m-phone[data-m-tab=team] #office-chat { display: none !important; }
  html.m-phone[data-m-tab=team] .layout { display: block !important; bottom: calc(var(--m-tab) + 42%) !important; overflow-y: auto !important; overflow-x: hidden !important; background: #fff; }
  html.m-phone[data-m-tab=team] .layout > .left > * { position: static !important; }
  html.m-phone[data-m-tab=team] .layout > main { display: none !important; }
  html.m-phone[data-m-tab=team] .layout > .left { display: block !important; position: static !important; width: 100% !important; height: auto !important; padding: 10px 12px !important; border: 0 !important; overflow: visible !important; }
  html.m-phone[data-m-tab=team] .left .section-title { display: block !important; margin-top: 4px; }
  html.m-phone[data-m-tab=team] .room-tabs { display: flex !important; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
  html.m-phone[data-m-tab=team] .room-tabs button { flex: 1 1 45%; min-height: 42px; font-size: 13px; }
  html.m-phone[data-m-tab=team] .agent-list { display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; overflow: visible !important; }
  html.m-phone[data-m-tab=team] .agent { min-width: 0 !important; writing-mode: horizontal-tb !important; flex-direction: row !important; height: auto !important; min-height: 52px; }
  html.m-phone[data-m-tab=team] .agent * { writing-mode: horizontal-tb !important; }
  html.m-phone[data-m-tab=team] .agent .portrait { display: block !important; }
  html.m-phone[data-m-tab=team] #detail.right { display: block !important; top: auto !important; height: 42% !important; overflow: auto !important; border-top: 2px solid #276f60 !important; padding: 10px 14px !important; z-index: 20; background: #fff; grid-template-columns: 1fr !important; }
  html.m-phone[data-m-tab=team] #detail .row { display: flex !important; justify-content: space-between; gap: 10px; }
  html.m-phone[data-m-tab=team] #detail .row span { display: inline !important; font-size: 12px !important; }
}
