/* Touch-first workspace adaptation. Desktop rules remain unchanged at >=1024px. */
.mobile-topbar{display:none}

@media(max-width:1023px){
  :root{
    --mobile-edge:12px;
    --mobile-topbar-height:64px;
    --mobile-nav-height:78px;
    --mobile-bottom-space:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
  }
  html,body{width:100%;height:100%;max-width:100%;overflow:hidden;overscroll-behavior:none}
  body{background:#fbf7f3}
  body.mobile-menu-open,body.mobile-widget-reordering{overflow:hidden;touch-action:none}
  .app.workspace-shell{
    display:block!important;width:100%!important;height:var(--mobile-viewport-height,100dvh)!important;
    min-height:0!important;padding:0!important;overflow:hidden!important;
  }
  .workspace-shell>.workspace-global-sidebar,.workspace-module-sidebar,.workspace-global-reveal,
  .workspace-module-reveal,.workspace-hot-zone,.workspace-tooltip,.workspace-resizer,.workspace-sidebar-collapse{
    display:none!important;
  }
  /* The desktop ID rule otherwise keeps a hidden module sidebar in normal flow at tablet widths. */
  #app.workspace-shell > #workspaceModuleSidebar{display:none!important}
  .workspace-shell>.workspace-main{
    display:flex!important;width:100%!important;height:var(--mobile-viewport-height,100dvh)!important;
    min-width:0!important;min-height:0!important;flex-direction:column!important;margin:0!important;
    padding:0 0 var(--mobile-bottom-space)!important;overflow:hidden!important;border:0!important;
    border-radius:0!important;background:#fffdfb!important;box-shadow:none!important;
  }
  .workspace-main>header{
    position:relative!important;z-index:16!important;display:grid!important;min-height:var(--mobile-topbar-height)!important;
    flex:0 0 auto!important;grid-template-columns:1fr!important;align-content:start!important;margin:0!important;
    padding:max(8px,env(safe-area-inset-top)) var(--mobile-edge) 8px!important;gap:8px!important;
    border:0!important;border-bottom:1px solid #ece5df!important;border-radius:0!important;
    background:rgba(255,253,251,.96)!important;box-shadow:none!important;backdrop-filter:blur(18px)!important;
  }
  .mobile-topbar{display:grid;grid-template-columns:44px minmax(0,1fr) auto;align-items:center;gap:8px;min-height:44px}
  .mobile-topbar-button,.mobile-topbar-avatar{
    position:relative;display:grid;width:44px;height:44px;min-width:44px;place-items:center;padding:0;
    border:0;border-radius:12px;background:transparent;color:#594f49;cursor:pointer;-webkit-tap-highlight-color:transparent;
  }
  .mobile-topbar-button[hidden]{display:none!important}
  .mobile-topbar-button:active,.mobile-topbar-avatar:active{background:#f5ece5;transform:scale(.97)}
  .mobile-topbar-title{display:grid;min-width:0;gap:1px}
  .mobile-topbar-title span{color:#998a80;font-size:10px;line-height:1.2}
  .mobile-topbar-title b{overflow:hidden;color:#282420;font-size:17px;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}
  .mobile-topbar-actions{display:flex;align-items:center;gap:2px}
  .mobile-topbar-avatar img{width:32px;height:32px;border-radius:10px;object-fit:cover;background:#fff0e5}
  .mobile-topbar-notification i{position:absolute;top:5px;right:4px;display:grid;min-width:16px;height:16px;place-items:center;padding:0 3px;border-radius:9px;background:#e86748;color:#fff;font:700 9px Arial}
  .workspace-main>header>.page-heading{display:none!important}
  .workspace-main>header>.actions{display:none!important;width:100%!important;grid-template-columns:minmax(0,1fr) 44px!important;gap:8px!important}
  .workspace-main>header.mobile-search-open>.actions{display:grid!important}
  .workspace-main>header>.actions .search{display:flex!important;width:100%!important;height:44px!important}
  .workspace-main>header>.actions>#notificationBtn{display:none!important}
  .workspace-main>header>.actions>#refresh{width:44px!important;height:44px!important}
  .workspace-main>header>.header-create{display:none!important}
  .workspace-main>header>.header-create::-webkit-scrollbar{display:none}
  .workspace-main>header>.header-create:not(:has(button:not(.hidden))){display:none!important}
  .workspace-main>header>.header-create button{min-width:max-content!important;height:40px!important;flex:0 0 auto!important}
  #content{
    width:100%!important;min-width:0!important;min-height:0!important;flex:1!important;padding:12px var(--mobile-edge) 16px!important;
    overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  }
  #content>*{max-width:100%!important;min-width:0!important}
  .mobile-nav{
    position:fixed!important;z-index:30!important;left:50%!important;right:auto!important;bottom:max(6px,env(safe-area-inset-bottom))!important;
    display:grid!important;width:min(560px,calc(100% - 16px))!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:2px!important;padding:6px!important;transform:translateX(-50%);border:1px solid rgba(255,255,255,.92)!important;
    border-radius:20px!important;background:rgba(255,250,246,.94)!important;box-shadow:0 10px 28px rgba(105,67,43,.22)!important;
    backdrop-filter:blur(20px)!important;
  }
  .mobile-nav-btn{display:grid!important;min-width:0!important;min-height:54px!important;place-items:center!important;align-content:center!important;gap:2px!important;padding:5px 2px!important;border:0!important;border-radius:14px!important;background:transparent!important;color:#887b72!important;font:inherit!important}
  .mobile-nav-btn>small{max-width:100%;overflow:hidden;font-size:10px;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}
  .mobile-nav-btn.active{background:#fff0e5!important;color:#cb642f!important}
  .mobile-nav-btn.active>small{font-weight:700}
  .mobile-menu{position:fixed!important;z-index:80!important;inset:0!important;display:none}
  .mobile-menu:not(.hidden){display:block!important}
  .mobile-menu-mask{position:absolute;inset:0;width:100%;height:100%;border:0;background:rgba(48,35,27,.34);backdrop-filter:blur(4px)}
  .mobile-menu-card{
    position:absolute!important;right:0!important;bottom:0!important;left:0!important;width:min(620px,100%)!important;max-height:min(84dvh,760px)!important;
    margin:auto!important;padding:10px 16px calc(18px + env(safe-area-inset-bottom))!important;overflow:auto!important;
    border:1px solid #f0e3da!important;border-radius:24px 24px 0 0!important;background:#fffdfb!important;
    box-shadow:0 -16px 48px rgba(70,47,33,.2)!important;transition:transform .18s ease,opacity .18s ease;
  }
  .mobile-menu-card.is-sheet-dragging{transition:none!important}
  .mobile-menu-handle{width:42px;height:5px;margin:1px auto 12px;border-radius:99px;background:#d9cec7;touch-action:none}
  .mobile-menu-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}
  .mobile-menu-close{display:grid;width:44px;height:44px;place-items:center;border:1px solid #ede2dc;border-radius:13px;background:#fff;color:#75665c}
  .mobile-profile{min-height:64px}
  .mobile-menu-links{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .mobile-menu-link{min-height:58px!important}
  .mobile-page-actions{margin:4px 0 14px;padding:12px;border:1px solid #eee3dc;border-radius:16px;background:#fff9f5}
  .mobile-page-actions[hidden]{display:none!important}
  .mobile-page-actions h3{margin:0 0 8px;color:#83756c;font-size:12px}
  .mobile-page-actions>div{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none}
  .mobile-page-actions button{display:flex;min-width:max-content;min-height:44px;align-items:center;gap:7px;padding:0 13px;border:1px solid #eadfd8;border-radius:12px;background:#fff;color:#594e47;font-weight:650}

  /* Touch geometry and generic overlays. */
  button,.soft-btn,.orange-btn,.ghost,.text-btn{touch-action:manipulation}
  .round,.admin-icon-button,.sv2-icon-btn,.md-icon-button{min-width:44px!important;min-height:44px!important}
  .modal{z-index:100!important;align-items:flex-end!important;padding:0!important}
  .modal-card{
    width:100%!important;max-width:none!important;max-height:min(92dvh,var(--mobile-viewport-height,92dvh))!important;
    padding:24px 16px calc(16px + env(safe-area-inset-bottom))!important;overflow:auto!important;
    border-radius:24px 24px 0 0!important;background:#fffdfb!important;
  }
  .modal-card:before{display:block;width:42px;height:5px;margin:-12px auto 14px;border-radius:99px;background:#d9cec7;content:""}
  .modal-card>.close{width:44px!important;height:44px!important}
  .modal-foot{position:sticky!important;bottom:calc(-16px - env(safe-area-inset-bottom))!important;z-index:2;margin-right:-16px!important;margin-bottom:calc(-16px - env(safe-area-inset-bottom))!important;margin-left:-16px!important;padding:12px 16px calc(12px + env(safe-area-inset-bottom))!important;background:rgba(255,253,251,.96)!important}
  .widget-gallery-layer{align-items:end!important;padding:0!important}
  .widget-gallery{width:100%!important;max-height:88dvh!important;padding:22px 16px calc(18px + env(safe-area-inset-bottom))!important;border-radius:24px 24px 0 0!important}
  .widget-gallery-grid{grid-template-columns:1fr!important}
  .media-viewer{inset:0!important;padding:0!important}
  .media-viewer-panel{width:100vw!important;height:var(--mobile-viewport-height,100dvh)!important;min-width:0!important;max-width:none!important;max-height:none!important;border:0!important;border-radius:0!important;box-shadow:none!important}
  .media-viewer-panel header{padding-top:env(safe-area-inset-top)!important}
  .media-viewer-panel header button,.media-zoom-tools button{min-width:44px!important;min-height:44px!important}
  .media-viewer-stage img,.media-viewer-stage video{max-width:calc(100vw - 24px)!important;max-height:calc(var(--mobile-viewport-height,100dvh) - 120px)!important}

  /* Home: one/two columns are driven by existing grid breakpoints; touch uses long-press. */
  .view-dashboard .widget-desktop-head{margin:0 0 10px!important;padding:16px!important;border-radius:16px!important}
  .view-dashboard .widget-desktop-head h2{font-size:21px!important}
  .view-dashboard #widgetSettings{min-height:44px!important;padding-block:0!important}
  .view-dashboard .widget-card{border-radius:15px!important}
  .view-dashboard .widget-dashboard-grid{--widget-row-height:54px!important}
  .view-dashboard .widget-dashboard-grid.widget-mobile-autoflow{grid-template-columns:minmax(0,1fr)!important;grid-auto-rows:auto!important;align-items:start!important;min-height:0!important}
  .view-dashboard .widget-dashboard-grid.widget-mobile-autoflow .widget-card{height:auto!important;min-height:0!important;grid-column:1!important;grid-row:auto!important}
  .view-dashboard .widget-resize-corner{display:none!important}
  .view-dashboard .widget-drag-handle{opacity:0!important;pointer-events:none!important}
  .view-dashboard .widget-card.is-widget-dragging .widget-drag-handle{opacity:1!important}
  .view-dashboard .widget-card.is-widget-dragging{touch-action:none}
  .view-dashboard .widget-week{overflow-x:auto;overscroll-behavior-x:contain}

  /* Messages become a two-level full-height page. */
  .workspace-main.message-page>header{display:none!important}
  .workspace-main.message-page{padding-bottom:var(--mobile-bottom-space)!important}
  .workspace-main.message-page>#content{height:100%!important;padding:0!important;overflow:hidden!important}
  .chat-shell{display:grid!important;width:100%!important;height:100%!important;min-height:0!important;max-height:none!important;grid-template-columns:minmax(0,1fr)!important;border:0!important;border-radius:0!important;background:#fffdfb!important;box-shadow:none!important}
  .chat-shell .chat-sidebar{display:grid!important;width:100%!important;max-width:none!important;height:100%!important;min-height:0!important;grid-template-rows:auto auto auto minmax(0,1fr)!important;flex:none!important;padding:10px 12px!important;overflow:hidden!important;border:0!important;background:#fffaf6!important}
  .chat-shell .chat-sidebar>*{grid-column:1!important}
  .chat-shell.mobile-chat-detail .chat-sidebar{display:none!important}
  .chat-shell.mobile-chat-list .chat-main{display:none!important}
  .chat-sidebar-head{grid-row:1!important;min-height:54px}
  .chat-sidebar-head h2{font-size:19px!important}
  .chat-sidebar-actions{display:flex!important;gap:4px!important}
  .chat-sidebar-actions .round{display:inline-flex!important;width:auto!important;min-width:44px!important;align-items:center!important;gap:6px!important;padding:0 10px!important}
  .chat-sidebar .chat-sidebar-actions .round{width:auto!important;min-width:44px!important;height:44px!important;padding:0 10px!important;white-space:nowrap!important}
  .chat-sidebar-actions #toggleMembers:after{content:"联系人";font-size:12px;font-weight:650}
  .chat-sidebar-actions #newGroup:after{content:"发起聊天";font-size:12px;font-weight:650}
  .conversation-search{grid-row:2!important;min-height:44px!important}
  .chat-sidebar .conversation-search{display:grid!important;grid-template-columns:18px minmax(0,1fr) 22px;align-items:center;gap:6px;height:44px!important;margin:4px 0 8px;padding:0 10px;border:1px solid #e7ddd6;border-radius:9px;background:#fff}
  .chat-sidebar .conversation-search>span{display:grid;place-items:center}
  .chat-sidebar .conversation-search input{width:100%;min-width:0;height:40px;border:0;background:transparent;box-shadow:none;font-size:14px}
  .chat-sidebar .conversation-search button[hidden]{display:none!important}
  .conversation-mode-switch{grid-row:3!important;min-height:40px!important;margin:4px 0 8px!important}
  .message-page .chat-shell .conversation-list{grid-row:4!important;display:grid!important;max-height:none!important;min-height:0!important;gap:4px!important;overflow-y:auto!important;padding:0 0 12px!important}
  .chat-conversations:before{padding:4px 4px 2px;color:#8b7c73;font-size:12px;font-weight:650;content:"最近会话"}
  .chat-conversations.is-categories:before{display:none}
  .chat-conversation{min-height:62px!important;padding:8px!important;border-radius:12px!important}
  .chat-main{display:grid!important;height:100%!important;min-height:0!important;grid-template-rows:auto minmax(0,1fr) auto!important;margin:0!important;border:0!important;border-radius:0!important}
  .chat-main-head{min-height:58px!important;padding:8px 10px!important;background:#fffdfb!important}
  .mobile-chat-back{display:var(--sy-chat-back-display-mobile,grid);width:44px;height:44px;flex:0 0 44px;place-items:center;padding:0;border:0;border-radius:12px;background:transparent;color:#584b43}
  .mobile-chat-back .sy-icon{width:var(--sy-chat-back-icon-size,20px);height:var(--sy-chat-back-icon-size,20px);color:var(--sy-chat-back-icon-color,currentColor)}
  .chat-messages{min-height:0!important;max-height:none!important;overflow-y:auto!important;padding:14px 10px 18px!important;overscroll-behavior:contain}
  .chat-bubble{max-width:88%!important}
  .chat-bubble>img{width:32px!important;height:32px!important}
  .chat-bubble p{font-size:14px!important}
  .recall-message{min-width:44px;min-height:36px;opacity:1!important}
  .chat-compose{grid-template-columns:44px minmax(0,1fr) 64px!important;gap:7px!important;padding:8px 10px max(8px,env(safe-area-inset-bottom))!important;background:#fffdfb!important}
  .chat-compose textarea{min-height:44px!important;max-height:92px!important;resize:none!important;font-size:16px!important}
  .chat-compose .orange-btn,.chat-attach{height:44px!important;min-height:44px!important}
  .chat-composer{display:grid!important;height:auto!important;min-height:0!important;grid-template-rows:44px auto!important;gap:4px!important;padding:6px 10px max(8px,env(safe-area-inset-bottom))!important;border-top:1px solid #ece5df!important;background:#fffdfb!important}
  .chat-composer .composer-toolbar{display:flex!important;height:44px!important;align-items:center!important;gap:8px!important;padding:0!important}
  .chat-composer .composer-action{width:44px!important;height:44px!important;min-width:44px!important;justify-content:center!important;padding:0!important}
  .chat-composer .composer-editor{display:grid!important;height:auto!important;grid-template-columns:minmax(0,1fr) 64px!important;align-items:end!important;gap:8px!important;padding:0!important}
  .chat-composer textarea{width:100%!important;min-height:44px!important;max-height:92px!important;padding:10px 12px!important;resize:none!important;font-size:16px!important;line-height:22px!important}
  .chat-composer .orange-btn{width:64px!important;height:44px!important;min-height:44px!important;margin:0!important}
  .chat-media .media-item{width:min(55vw,210px)!important;height:auto!important;aspect-ratio:4/3}

  /* Documents, multidimensional table and record drawers. */
  .view-documents{min-height:0!important}
  .docs-shell{display:grid!important;height:100%!important;min-height:0!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr)!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
  .docs-categories{display:flex!important;width:100%!important;height:auto!important;min-height:56px!important;max-height:64px!important;flex:0 0 auto!important;align-items:center!important;flex-direction:row!important;margin:0 0 8px!important;padding:6px!important;gap:5px!important;overflow-x:auto!important;overflow-y:hidden!important;border:1px solid #eee5df!important;border-radius:14px!important;background:#fff!important}
  .docs-category-head{display:none!important}
  .docs-category{width:auto!important;height:44px!important;min-width:max-content!important;min-height:44px!important;flex:0 0 auto!important;padding:8px 10px!important;white-space:nowrap!important}
  .docs-main{min-width:0!important;min-height:0!important;height:auto!important;padding:12px!important;overflow:auto!important;border-radius:15px!important}
  .docs-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:center!important;gap:10px!important}
  .docs-toolbar>div:last-child{display:flex!important;gap:6px!important;flex-wrap:nowrap!important}
  .docs-toolbar button{min-height:44px!important;padding-inline:11px!important;white-space:nowrap!important}
  .docs-list{min-height:0!important;overflow:auto!important}
  .document-row{grid-template-columns:minmax(0,1fr) 44px!important;min-height:72px!important;height:auto!important;padding:10px 4px!important}
  .document-row>span:nth-child(2),.document-row>span:nth-child(3),.document-row>span:nth-child(4){display:none!important}
  .document-name b{font-size:14px!important}
  .document-actions{align-self:center!important}
  .document-more{width:44px!important;height:44px!important}
  .document-editor-shell{height:calc(var(--mobile-viewport-height,100dvh) - var(--mobile-topbar-height) - var(--mobile-bottom-space) - 24px)!important;min-height:0!important;border-radius:0!important}
  body:has(#content>.md-workspace) .workspace-main>header{display:none!important}
  body:has(#content>.md-workspace) .workspace-main{padding-bottom:var(--mobile-bottom-space)!important}
  body:has(#content>.md-workspace) #content{padding:0!important;overflow:hidden!important}
  .md-workspace{width:100%!important;height:100%!important;min-width:0!important;border:0!important;border-radius:0!important}
  .md-workspace-head{height:52px!important;padding:0 8px!important}
  .md-title b{max-width:42vw!important}
  .md-viewbar{padding-left:6px!important;overflow-x:auto!important}
  .md-view-tabs{overflow-x:auto!important;scrollbar-width:none}
  .md-view-tabs button{min-height:44px!important;white-space:nowrap!important}
  .md-toolbar{min-height:92px!important;padding:6px 8px!important;align-content:center!important}
  .md-toolbar-left,.md-toolbar-right{width:100%!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:none}
  .md-toolbar-search{min-width:150px!important;flex:1!important}
  .md-grid-scroll,.md-grid-viewport,.md-view-host{min-width:0!important;overflow:auto!important;overscroll-behavior:contain}
  .md-grid-head>.md-select-cell,.md-grid-row>.md-select-cell{position:sticky!important;left:0!important;z-index:8!important;background:#fff!important}
  .md-record-drawer{width:100vw!important;max-width:none!important;height:100dvh!important;border-radius:0!important}
  .md-drawer-layer{z-index:110!important}
  .md-drawer-summary{grid-template-columns:1fr!important}
  .md-floating-panel,.md-cell-popover,.md-attachment-list-panel{max-width:calc(100vw - 16px)!important}

  /* Attendance: touch-first cards/agenda, with large desktop matrices kept inside local scrollers. */
  .workspace-main.attendance-page>#content{padding:0!important;overflow:hidden!important}
  .schedule-v2{height:100%!important;min-height:0!important;padding:0!important;overflow:hidden!important}
  .schedule-v2 button,.schedule-v2 select{min-height:44px}
  .schedule-v2 .soft-btn,.schedule-v2 .orange-btn,.schedule-v2 .sv2-field select{height:44px}
  .schedule-v2 .sv2-icon-btn{width:44px;height:44px!important}
  .sv2-tabs{min-height:50px!important;overflow-x:auto!important;scrollbar-width:none}
  .sv2-tabs button{min-width:max-content!important;min-height:44px!important}
  .sv2-toolbar{flex:0 0 auto!important;align-items:stretch!important;flex-direction:column!important;padding:8px 10px!important;gap:8px!important}
  .sv2-month-popover{right:auto;bottom:calc(var(--mobile-bottom-space) + 12px);width:min(320px,calc(100vw - 24px));max-height:calc(100dvh - var(--mobile-bottom-space) - 24px);overflow:auto}
  .sv2-toolbar-main,.sv2-toolbar-actions{width:100%!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:none}
  .sv2-body{min-height:0!important;padding:10px!important;overflow:auto!important}
  .sv2-month-head{display:grid!important;gap:10px!important}
  .sv2-view-switch{width:100%!important}
  .sv2-view-switch button{min-height:44px!important;flex:1!important}
  .sv2-month-summary,.sv2-stats-cards{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sv2-month-summary>span,.sv2-stats-cards>span{min-height:68px!important;border:1px solid var(--sv2-line)!important;border-radius:11px!important}
  .sv2-agenda-list{max-height:none!important;overflow:visible!important}
  .sv2-agenda-day{grid-template-columns:58px minmax(0,1fr)!important}
  .sv2-agenda-date{min-height:58px!important}
  .sv2-agenda-groups{padding:8px!important}
  .sv2-agenda-group{grid-template-columns:1fr!important}
  .sv2-person-chip{min-height:36px!important}
  .sv2-month-calendar-wrap,.sv2-matrix-wrap,.sv2-summary-table-wrap{max-width:100%!important;overflow:auto!important;overscroll-behavior:contain}
  .sv2-month-calendar-wrap{overflow-x:hidden!important}
  .sv2-month-weekdays,.sv2-month-calendar{width:100%!important;min-width:0!important;grid-template-columns:repeat(7,minmax(0,1fr))!important}
  .sv2-month-weekdays span{min-width:0!important;padding:7px 1px!important;font-size:11px!important}
  .sv2-month-blank,.sv2-month-day{min-width:0!important;min-height:76px!important}
  .sv2-month-day{gap:4px!important;padding:6px 4px!important}
  .sv2-month-day-number{font-size:13px!important}
  .sv2-month-counts{gap:2px!important}
  .sv2-month-counts i,.sv2-month-counts em{max-width:100%!important;padding:2px 3px!important;overflow:hidden!important;font-size:9px!important;text-overflow:ellipsis!important}
  .sv2-matrix{min-width:760px!important}
  .sv2-stats-grid{grid-template-columns:1fr!important}
  .sv2-panel-actions{align-items:stretch!important;flex-direction:column!important}
  .sv2-modal-layer{z-index:110!important;align-items:flex-end!important;padding:0!important}
  .sv2-modal{width:100%!important;max-width:none!important;max-height:92dvh!important;border-radius:24px 24px 0 0!important}
  .sv2-modal-layer.is-drawer .sv2-modal{height:100dvh!important;max-height:100dvh!important;border-radius:0!important}

  /* Account management, quotas and organization. */
  .admin-page-shell{height:100%!important;min-height:0!important;overflow:hidden!important}
  .account-tabs{display:flex!important;min-height:50px!important;overflow-x:auto!important;scrollbar-width:none}
  .account-tabs button{min-width:max-content!important;min-height:44px!important}
  .admin-tab-stage{min-width:0!important;min-height:0!important;overflow:auto!important}
  .organization-view-toolbar{align-items:stretch!important;flex-direction:column!important}
  .organization-view-toolbar .account-search{width:100%!important;max-width:none!important}
  .organization-view-switch{align-self:flex-start!important}
  .org-chart-panel{min-height:520px!important;border-radius:12px!important}
  .org-chart-controls{right:8px!important;bottom:8px!important;max-width:calc(100% - 16px);overflow-x:auto}
  .org-chart-controls button{min-width:44px!important;min-height:44px!important}
  .account-table-wrap,.quota-table-wrap,.account-logs-scroll{max-width:100%!important;overflow:auto!important;overscroll-behavior:contain}
  .account-member-table,.quota-table{width:100%!important;min-width:0!important}
  .account-member-table th:nth-child(3),.account-member-table th:nth-child(4),.account-member-table th:nth-child(5),
  .account-member-table td:nth-child(3),.account-member-table td:nth-child(4),.account-member-table td:nth-child(5){display:none!important}
  .quota-table th:nth-child(3),.quota-table th:nth-child(4),.quota-table th:nth-child(5),.quota-table th:nth-child(6),.quota-table th:nth-child(7),.quota-table th:nth-child(9),
  .quota-table td:nth-child(3),.quota-table td:nth-child(4),.quota-table td:nth-child(5),.quota-table td:nth-child(6),.quota-table td:nth-child(7),.quota-table td:nth-child(9){display:none!important}
  .account-member-table th,.account-member-table td,.quota-table th,.quota-table td{padding:10px 7px!important;font-size:11px!important}
  .account-member-table th:nth-child(1),.account-member-table td:nth-child(1),.quota-table th:nth-child(2),.quota-table td:nth-child(2){position:sticky;left:0;z-index:2;background:#fff}
  .account-drawer-layer{z-index:115!important;align-items:flex-end!important;justify-content:stretch!important}
  .account-drawer{width:100vw!important;height:100dvh!important;border-radius:0!important;box-shadow:none!important}
  .account-drawer-header{min-height:58px!important;padding:8px 12px!important}
  .account-drawer-header>button{width:44px!important;height:44px!important}
  .account-drawer-tabs{overflow-x:auto!important;white-space:nowrap!important}
  .admin-popover{position:fixed!important;right:8px!important;bottom:calc(var(--mobile-bottom-space) + 8px)!important;left:8px!important;top:auto!important;width:auto!important;max-height:58dvh!important;overflow:auto!important}

  /* AI creation iframe stays within the viewport; its own canvas owns pan/zoom. */
  .workspace-main.ai-canvas-page>header{display:none!important}
  .workspace-main.ai-canvas-page{padding-bottom:var(--mobile-bottom-space)!important}
  .workspace-main.ai-canvas-page>#content{height:100%!important;padding:0!important;overflow:hidden!important}
  .ai-canvas-workspace{width:100%!important;height:100%!important;min-width:0!important;overflow:hidden!important;border:0!important;border-radius:0!important}
  .ai-canvas-frame{display:block!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;border-radius:0!important}

  /* Assistant: keep the mascot inside the useful area and use a full-height mobile conversation surface. */
  .yyf-character{max-width:72px!important;max-height:72px!important}
  .yyf-quick-action{min-height:44px!important;border-radius:22px!important}
  .yyf-dialog.is-open{
    position:fixed!important;inset:0 0 var(--mobile-bottom-space) 0!important;width:100vw!important;height:auto!important;max-width:none!important;max-height:none!important;
    border-radius:0!important;transform:none!important;
  }
  .yyf-dialog.is-open .yyf-panel-head{padding-top:max(12px,env(safe-area-inset-top))!important}
  .yyf-dialog-body{padding:14px!important}
  .yyf-dialog-shortcuts{display:flex!important;grid-template-columns:none!important;overflow-x:auto!important;padding-bottom:2px!important}
  .yyf-dialog-shortcuts button{min-width:132px!important;height:44px!important;flex:0 0 auto!important}
  .yyf-composer{padding-bottom:max(12px,env(safe-area-inset-bottom))!important}
}

@media(max-width:767px){
  /* A member directory is a card list on phones, not a squeezed desktop table. */
  .account-table-wrap:has(.account-member-table){overflow:visible!important}
  .account-member-table{display:block!important;border:0!important;background:transparent!important}
  .account-member-table thead{display:none!important}
  .account-member-table tbody{display:grid!important;gap:10px!important;padding:2px!important}
  .account-member-table tr{position:relative!important;display:grid!important;grid-template-columns:minmax(0,1fr) 44px!important;gap:7px 10px!important;padding:12px!important;border:1px solid #eee3dc!important;border-radius:14px!important;background:#fff!important;box-shadow:0 4px 14px rgba(73,52,39,.045)!important}
  .account-member-table td{position:static!important;display:flex!important;height:auto!important;min-width:0!important;min-height:0!important;align-items:flex-start!important;gap:8px!important;padding:0!important;border:0!important;background:transparent!important;color:#4b423d!important;font-size:14px!important;line-height:1.45!important}
  .account-member-table td:nth-child(1){grid-column:1 / -1!important;padding-right:48px!important}
  .account-member-table td:nth-child(n+2):nth-child(-n+6){grid-column:1!important}
  .account-member-table td:nth-child(n+2):nth-child(-n+6):before{width:58px;flex:0 0 58px;color:#95877e;font-size:12px;font-weight:600}
  .account-member-table td:nth-child(2):before{content:"部门"}
  .account-member-table td:nth-child(3):before{content:"角色"}
  .account-member-table td:nth-child(4):before{content:"职位"}
  .account-member-table td:nth-child(5):before{content:"权限"}
  .account-member-table td:nth-child(6):before{content:"状态"}
  .account-member-table td:nth-child(5){display:grid!important;grid-template-columns:58px minmax(0,1fr)!important}
  .account-member-table td:nth-child(3),.account-member-table td:nth-child(4){display:flex!important}
  .account-member-table td:nth-child(5):before{grid-row:1 / span 2}
  .account-member-table td:nth-child(5) small{display:block!important;margin-top:2px!important;color:#8c7f77!important;font-size:12px!important}
  .account-member-table td:nth-child(7){position:absolute!important;top:10px!important;right:10px!important;display:block!important}
  .account-user-cell{width:100%!important;min-height:48px!important;padding:0!important;text-align:left!important}
  .account-user-cell img{width:42px!important;height:42px!important}
  .account-user-cell b{font-size:15px!important}
  .account-member-grip{display:none!important}
  .account-row-edit{width:44px!important;height:44px!important}
}

@media(max-width:560px){
  :root{--mobile-edge:10px}
  .mobile-topbar{gap:4px}
  .mobile-topbar-button,.mobile-topbar-avatar{width:44px;height:44px;min-width:44px}
  .mobile-menu-links{grid-template-columns:1fr 1fr!important}
  .widget-dashboard-grid{gap:10px!important}
  .widget-shortcuts{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .sv2-agenda-group>div{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .sv2-person-chip{max-width:none!important}
  .account-logs-table{min-width:720px!important}
}

@media(hover:none) and (pointer:coarse){
  .recall-message,.widget-card-menu{opacity:1!important;pointer-events:auto!important}
  .widget-card:hover,.chat-conversation:hover,.sv2-person-chip:hover{transform:none!important}
}

@media(prefers-reduced-motion:reduce){
  .mobile-menu-card,.mobile-nav-btn,.mobile-topbar-button,.mobile-topbar-avatar{transition:none!important}
}
