/* 手机（业主 2026-11-13 晚，拿微信的截图：「切换放到下方。点击进入具体会话以后，底部隐藏」）：
   聊天、私聊、主页、任务四颗在屏幕最底下一排；进到一段会话底下那一排收起，顶上一行「‹ 名字 · 文件」。
   会话列表、私聊的人是「聊天」「私聊」各自的一整页，顶上一行左「应用」、右「用户」。 */
.mobile-nav,
.mobile-tabs,
.mobile-session-host,
.mobile-session-new,
.mobile-session-private,
.mobile-drawer-foot { display: none; }

@media (max-width: 640px) {
  /* 上下各留多少：顶上那一行（--mobile-bar-h，没有就是 0）、底下那一排（--mobile-tabs-h，进了会话是 0）。
     --topbar-h 是两头加起来——几页按「一屏减去它」排高度（主页的办公室、项目主页、几个应用）。
     底下那一排自己多高（--mobile-tabbar）：主屏幕上的网页应用一直铺到屏幕最底下，横条压在那里，多让一截。 */
  .has-mobile-nav { --mobile-tabbar: 60px; --mobile-bar-h: 0px; --mobile-tabs-h: var(--mobile-tabbar);
    --topbar-h: calc(var(--mobile-bar-h) + var(--mobile-tabs-h)); }
  .is-standalone .has-mobile-nav { --mobile-tabbar: 78px; }
  .has-mobile-nav.has-mobile-back { --mobile-bar-h: 56px; --mobile-tabs-h: 0px; }
  .has-mobile-nav > .topbar,
  .has-mobile-nav .chat-crumb { display: none; }
  .has-mobile-nav > .shell-body { padding-top: var(--mobile-bar-h); padding-bottom: var(--mobile-tabs-h); }
  .has-mobile-nav.chat-body > .shell-body { padding-top: 0; }

  /* 顶上那一行只在第二层（进了一段会话）：「‹」在左，名字在正中，「文件」在右。第一层的页没有这一行；
     站在列表上也没有（列表有自己的一行）。 */
  .has-mobile-back .mobile-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 51; height: 56px; padding: 6px;
    display: flex; align-items: center; background: var(--surface-0); color: var(--fg-soft); }
  .has-mobile-nav.is-phone-list .mobile-nav { display: none; }
  /* 「‹」没有底。外边 6 让图标落在跟正文同一条 16 的边上。 */
  .mobile-nav .mobile-nav-icon { position: relative; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; background: none;
    color: var(--fg-soft); text-decoration: none; cursor: pointer; }
  .mobile-nav-icon > .aimy-icon { width: 23px; height: 23px; }
  /* 名字按屏幕居中，两边各让出「‹」和「文件」那么宽，长了省略，不挤动两头。 */
  .mobile-nav .mobile-nav-title { position: absolute; top: 6px; left: 96px; right: 96px; height: 44px; margin: 0; padding: 0;
    display: flex; align-items: center; justify-content: center; min-width: 0; border: 0; background: none;
    color: var(--fg); font: inherit; font-size: 16px; font-weight: var(--weight-semi); text-align: center;
    pointer-events: none; }
  .mobile-nav-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 文件按钮在手机上搬进顶栏右侧，回到电脑宽度时归位，不占第二行。 */
  .mobile-nav .files-switch { position: static; flex: none; height: 44px; margin: 0 0 0 auto; }
  /* 手机上也是「文件」两个字的胶囊：看得见的 36 高，透明边把点的范围撑到 44。 */
  .mobile-nav .files-switch .files-view-button { height: 44px; border: 4px solid transparent; background-clip: padding-box; }

  /* 底下那一排：五颗平分一行，图标底下一行小字；当前那一颗字和图标都亮，别的淡。进了会话收起。 */
  .has-mobile-nav .mobile-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 72; height: var(--mobile-tabbar);
    padding: 4px 8px 0; box-sizing: border-box; display: flex; align-items: flex-start;
    background: var(--surface-1); color: var(--muted); }
  .has-mobile-nav.has-mobile-back:not(.is-phone-list) .mobile-tabs,
  .has-mobile-nav.is-mobile-keyboard .mobile-tabs { display: none; }
  .mobile-tabs .mobile-nav-tab { position: relative; flex: 1 1 0; min-width: 0; height: 52px; padding: 5px 0 0;
    display: flex; flex-direction: column; align-items: center; border-radius: 12px; color: var(--muted);
    text-decoration: none; -webkit-tap-highlight-color: transparent;
    transition: color .18s ease, opacity .18s ease, transform .18s ease; }
  .mobile-tabs .mobile-nav-tab.is-current { color: var(--fg); }
  .mobile-tab-icon { position: relative; display: block; width: 24px; height: 24px; }
  .mobile-tab-icon > .aimy-icon { display: block; width: 24px; height: 24px; }
  .mobile-tab-name { margin-top: 4px; font-size: 11px; line-height: 14px; white-space: nowrap; }
  /* 按下去就有反应（业主 2026-11-04 晚：「触摸的时候没有任何ui变化……摸了一个死的东西一样」）：一按，
     整颗淡一点、收一点；放手慢慢回来。iPhone 要页面听着触摸才画 :active（mobile-nav.js），
     自带的那块灰色点击高亮关掉，免得两层叠在一起。 */
  .mobile-nav .mobile-nav-icon { -webkit-tap-highlight-color: transparent;
    transition: background-color .18s ease, color .18s ease, transform .18s ease; }
  .mobile-nav .mobile-nav-icon:active { background: var(--surface-3); color: var(--fg); transform: scale(.9);
    transition-duration: 0s; }
  .mobile-tabs .mobile-nav-tab:active { background: var(--surface-2); color: var(--fg); transform: scale(.94);
    transition-duration: 0s; }
  /* 角上的记号都贴在图标右上角：聊天、私聊的红数，任务的绿数（几件在跑）。 */
  .mobile-tabs .topbar-tab-badge { position: absolute; top: -5px; left: 15px; right: auto; }
  /* 任务的绿数：跟桌面竖栏那一颗同一个样子（绿底深字），从图标右上角往右长，两位、三位数都在格子里。 */
  .mobile-tabs .live-count { position: absolute; top: -5px; left: 15px; right: auto; min-width: 18px; height: 18px; margin: 0;
    padding: 0 5px; box-sizing: border-box; justify-content: center; border-radius: 9px;
    background: var(--green-mark); color: var(--on-green-mark); font-size: 11px; font-weight: var(--weight-semi);
    line-height: 18px; white-space: nowrap; }
  .mobile-tabs .live-count .live-count-spin { display: none; }
  .mobile-nav [hidden],
  .mobile-tabs [hidden] { display: none; }
  .has-mobile-nav.chat-body .chat-scroll,
  .has-mobile-nav .room-view-scroll { padding-top: 68px; }
  .has-mobile-nav .chat-scroll.is-cut,
  .has-mobile-nav .room-view-scroll.is-cut {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 48px, #000 88px);
    mask-image: linear-gradient(to bottom, transparent 0, transparent 48px, #000 88px);
  }
  .has-mobile-nav .room-view-head { position: absolute; top: 64px; left: 12px; right: 12px; z-index: 7;
    display: flex; padding: 0; border: 0; }
  .has-mobile-nav .room-view-title,
  .has-mobile-nav .room-view-kind { display: none; }
  .has-mobile-nav .room-members { top: 112px; }
  /* 回上一层的「‹」在顶栏左上角（业主 2026-11-13）：第二行那一颗不再画，项目里的会话、群不再让出一整行。 */
  .has-mobile-nav .chat-crumb.is-back,
  .has-mobile-nav .room-view-head .chat-back { display: none; }
  .has-mobile-nav .room-view > .files-view,
  .has-mobile-nav .chat-shell > .files-view { top: 56px; }
  .has-mobile-nav .room-view > .files-view { position: absolute; right: 0; bottom: 0; left: 0; }
  .has-mobile-nav.has-mobile-room-actions .chat-scroll,
  .has-mobile-nav.has-mobile-room-actions .room-view-scroll { padding-top: 120px; }
  .has-mobile-nav.has-mobile-room-actions .chat-scroll.is-cut,
  .has-mobile-nav.has-mobile-room-actions .room-view-scroll.is-cut {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 108px, #000 144px);
    mask-image: linear-gradient(to bottom, transparent 0, transparent 108px, #000 144px);
  }
  .has-mobile-nav.has-mobile-room-actions .files-view { top: 112px; }
  /* 私聊顶上那一条事情（11-09「方案A」）：落在顶栏底下，对话接在它下面，不再让出顶栏那一截、也不淡掉头几行。 */
  .has-mobile-nav .room-things { width: calc(100% - 24px); margin-top: 64px; }
  .has-mobile-nav .room-things + .room-view-scroll { padding-top: 8px; }
  .has-mobile-nav .room-things + .room-view-scroll.is-cut {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
    mask-image: linear-gradient(to bottom, transparent 0, #000 16px);
  }
  .has-mobile-nav.is-mobile-typing .room-things { display: none; }

  /* 列表是一整页，不是抽屉（业主 2026-11-13：「直接显示整个对话列表（不再是抽屉，而是切换）」）。平时不出现；
     body 挂上 is-phone-list 时从屏幕顶铺到底下那一排，盖住这一页自己的内容，不压暗、不滑。
     列表住在 railbar 里，railbar 是 z 50 的弹性子项、自成一层，所以那一层整个抬到这一页内容之上。 */
  .mobile-session-host { display: block; }
  body.is-phone-list { overflow: hidden; }
  .has-mobile-sessions .railbar { display: block; position: static; z-index: 70; width: 0; padding: 0; border: 0; background: none; }
  .has-mobile-sessions .railbar-head { display: none; }
  .has-mobile-nav .chat-side { top: 0; bottom: var(--mobile-tabbar); left: 0; width: 100%; max-width: none; z-index: 70;
    padding: 0 16px 10px; background: var(--surface-0); border-radius: 0; box-shadow: none;
    display: none; transform: none; transition: none; }
  .has-mobile-nav.is-phone-list .chat-side { display: flex; }
  .has-mobile-nav .chat-side .chat-block-top { display: none; }
  .has-mobile-nav .chat-side[data-rail-level="projects"] .chat-block-list > .chat-search-wrap { margin-right: 0; }
  .has-mobile-nav .chat-side .chat-block { margin-top: 0; }
  .has-mobile-nav .chat-block-list { padding: 0; position: relative; }
  .has-mobile-nav .chat-block-list > .chat-search-wrap { min-height: 40px; margin: 0 46px 8px 0;
    padding: 0 12px; background: var(--surface-2); border-radius: 12px; }
  .has-mobile-nav .chat-search { font-size: 16px; }
  .has-mobile-nav .chat-block-list.has-mobile-private > .chat-search-wrap { margin-right: 90px; }
  .mobile-session-new,
  .mobile-session-private { display: flex; align-items: center; justify-content: center; position: absolute;
    right: 0; top: 0; width: 42px; height: 40px; border-radius: 12px; color: var(--fg-soft);
    -webkit-tap-highlight-color: transparent; }
  .mobile-session-private { right: 44px; }
  .mobile-session-private.is-on { color: var(--gold); }
  /* 一行一个名字：不写时间（10-24「列表不显示日期」，手机上没有悬停就不出），不挂「···」——
     改名、归档、删除按住一行出来（09-14：这些在清单里）。按下去这一行亮一档。
     整页了，一行 46 高、16 号字（抽屉时为了紧凑是 40、15）；列表上不亮「你在这儿」——这一页就是列表。 */
  .has-mobile-nav .chat-session-row { min-height: 46px; }
  /* 46 高里上下各留 13，文字与角标一起居中；不能只设最小高度，把文字留在底色顶边。 */
  .has-mobile-nav .chat-session { min-height: 46px; align-items: center; padding: 13px 12px; font-size: 16px; border-radius: 10px;
    -webkit-tap-highlight-color: transparent; }
  .has-mobile-nav .chat-side .chat-folder-head { min-height: 46px; font-size: 16px; -webkit-tap-highlight-color: transparent; }
  .has-mobile-nav .chat-side .chat-session.is-current,
  .has-mobile-nav .chat-side .chat-folder-head.is-current { background: none; }
  .has-mobile-nav .chat-side .chat-folder-head:active { background: var(--surface-2); }
  /* 每一行右边一颗「···」（业主 2026-11-13 晚：「会话列表这里长按改成右侧三个点的按钮」——按住出单子，手一抬
     还是跳进了那段会话）：一直露着，40 见方，淡一档；行里的字、在跑的数、没看的数给它让出右边那一截。
     写成 body.has-mobile-nav：chat.css 里「摸的屏幕上别的会话那颗是透明的、不接手指」那条是四个类，这里得压过它。 */
  .has-mobile-nav .chat-side .chat-session-row:not([data-draft-row]) > .chat-session { padding-right: 48px; }
  body.has-mobile-nav .chat-side .chat-session-row .chat-session-more { display: flex; visibility: visible; opacity: 1;
    right: 4px; width: 40px; height: 40px; margin-top: -20px; border-radius: 12px; color: var(--faint);
    -webkit-tap-highlight-color: transparent; }
  body.has-mobile-nav .chat-side .chat-session-row .chat-session-more:active,
  body.has-mobile-nav .chat-side .chat-session-row.is-open .chat-session-more { background: var(--surface-2); color: var(--fg); }
  .has-mobile-nav .chat-side .chat-session:active,
  .mobile-session-new:active,
  .mobile-session-private:active { background: var(--surface-2); }
  .has-mobile-nav .chat-side .chat-session-when { display: none; }
  .has-mobile-nav .chat-side-list { padding-left: 0; padding-right: 0; }
  /* 会话那张「···」单子在手机上搬到 body 底下（chat-sessions.js openMenu）：它得浮在整页的列表（z 70）、底下那一排
     （z 72）之上。 */
  .has-mobile-nav .chat-session-menu { z-index: 95; }
  .has-mobile-nav .chat-side-foot { padding-left: 0; }

  /* 列表页顶上那一行：左「应用」、中间这一页叫什么、右「用户」（像微信顶上那一行）。菜单从按钮底下展开，
     浮在列表上，不挤动会话；短屏长菜单在自身里面滚动。 */
  .chat-side > .mobile-drawer-foot { display: block; position: relative; flex: none; margin: 0 -10px 4px; }
  .mobile-drawer-doors { display: flex; align-items: center; height: 56px; }
  .mobile-list-title { flex: 1 1 auto; min-width: 0; color: var(--fg); font-size: 17px; font-weight: var(--weight-semi);
    text-align: center; }
  .mobile-scope-doors { position: relative; justify-content: space-between; }
  .mobile-scope-doors .mobile-list-title { position: absolute; left: 82px; right: 82px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
  .mobile-project-home { display: flex; align-items: center; min-height: 44px; padding: 0 10px;
    border-radius: 12px; color: var(--fg-soft); font-size: 14px; text-decoration: none; white-space: nowrap; }
  .mobile-project-home:active { background: var(--surface-2); }
  .mobile-drawer-doors .mobile-drawer-tile { position: relative; flex: 0 0 44px; width: 44px; height: 44px; padding: 0;
    display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%;
    background: none; color: var(--fg-soft); font: inherit; cursor: pointer;
    -webkit-tap-highlight-color: transparent; transition: background-color .18s ease; }
  .mobile-drawer-tile > .aimy-icon { flex: none; width: 22px; height: 22px; }
  .mobile-drawer-letter { width: 22px; height: 22px; font-size: 15px; font-weight: 600; line-height: 22px; text-align: center; }
  .mobile-drawer-name { max-width: 100%; margin-left: 10px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: 15px; line-height: 20px; }
  .mobile-drawer-doors .mobile-drawer-tile.is-current { background: var(--surface-2); color: var(--fg); }
  .mobile-drawer-doors .mobile-drawer-tile:active { background: var(--surface-3); transition-duration: 0s; }
  .mobile-drawer-tile.has-attention::after { content: ""; position: absolute; top: 7px; right: 7px;
    width: 7px; height: 7px; border-radius: 50%; background: var(--red-mark); }
  .mobile-drawer-menu { position: absolute; top: 54px; left: 6px; right: 6px; z-index: 2;
    max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); overflow-y: auto;
    padding: 10px; border-radius: 16px; background: var(--surface-2); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
  .mobile-drawer-app-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
  .mobile-drawer-app-grid .mobile-drawer-tile { display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-width: 0; min-height: 76px; padding: 8px 4px; border-radius: 10px;
    color: var(--fg-soft); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .mobile-drawer-app-grid .mobile-drawer-name { margin: 6px 0 0; font-size: 13px; }
  .mobile-drawer-app-grid .mobile-drawer-tile:active { background: var(--surface-3); }
  .mobile-drawer-me .topbar-nav-link { display: flex; align-items: center; min-height: 40px; padding: 0 12px;
    border-radius: 10px; color: var(--fg-soft); font-size: 15px; text-decoration: none;
    -webkit-tap-highlight-color: transparent; }
  .mobile-drawer-me .topbar-nav-link:active { background: var(--surface-2); }
  .mobile-drawer-me .topbar-menu-rule { margin: 4px 12px; border: 0; border-top: 1px solid var(--line-soft); }
  .mobile-drawer-alarm { display: flex; align-items: center; min-height: 40px; padding: 0 12px; color: var(--red);
    font-size: 15px; text-decoration: none; }
  .mobile-drawer-alarm > .aimy-icon { flex: none; margin-right: 10px; }
  .mobile-drawer-alarm.topbar-maint { border-radius: 10px; background: transparent; color: var(--gold); }
  .mobile-nav-live-link { display: block; padding: 8px 12px; color: var(--fg-soft); font-size: 13px; text-decoration: none; }
  .mobile-nav-live-link span { display: block; color: var(--muted); font-size: 11px; }
  .mobile-nav-live-link.is-attention span { color: var(--red); }
  .mobile-drawer-foot [hidden], .mobile-drawer-foot[hidden] { display: none; }

  .has-mobile-nav.is-mobile-typing .mobile-nav,
  .has-mobile-nav.is-mobile-keyboard .mobile-tabs,
  .has-mobile-nav.is-mobile-typing .chat-files-switch,
  .has-mobile-nav.is-mobile-typing .room-view-head,
  .has-mobile-nav.is-mobile-typing .chat-crumb.is-back { display: none; }
  .has-mobile-nav.is-mobile-typing .chat-scroll,
  .has-mobile-nav.is-mobile-typing .room-view-scroll { padding-top: 16px; }
  .has-mobile-nav.is-mobile-typing .chat-scroll.is-cut,
  .has-mobile-nav.is-mobile-typing .room-view-scroll.is-cut { -webkit-mask-image: none; mask-image: none; }
}

