/* V3.5：手机响应式外壳。桌面端只隐藏手机专用组件，不改变既有布局。 */
.mobile-nav-toggle,.mobile-nav-backdrop,[data-mobile-bottom-nav],[data-mobile-access-gate],[data-mobile-profile-panel]{display:none}

@media(max-width:820px){
  :root{--mobile-shell-header:58px;--mobile-shell-nav:68px}
  body{padding-bottom:calc(var(--mobile-shell-nav) + env(safe-area-inset-bottom,0px))}
  body.mobile-nav-open,body.mobile-profile-open{overflow:hidden}
  .app-shell{display:block}
  .sidebar{position:sticky;top:0;z-index:70;width:100%;height:58px;padding:8px 12px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;background:linear-gradient(90deg,#17366f,#24599a);box-shadow:0 5px 18px rgba(20,48,96,.2)}
  .sidebar .brand{min-width:0;margin:0;padding:0;gap:9px}
  .sidebar .brand-mark{width:32px;height:32px;flex:0 0 32px;border-radius:9px;font-size:16px}
  .sidebar .brand>div{min-width:0}
  .sidebar .brand strong{overflow:hidden;font-size:12px;text-overflow:ellipsis;white-space:nowrap}
  .sidebar .brand small,.sidebar-foot{display:none}
  .mobile-nav-toggle,[data-mobile-nav-toggle]{width:auto;min-height:36px;display:flex;align-items:center;gap:7px;padding:6px 10px;border:1px solid rgba(255,255,255,.22);border-radius:9px;background:rgba(255,255,255,.09);color:#fff;cursor:pointer}
  .mobile-nav-toggle>span,[data-mobile-nav-toggle]>span{font-size:17px;line-height:1}
  .mobile-nav-toggle>b,[data-mobile-nav-toggle]>b{font-size:11px}
  body.mobile-nav-open .mobile-nav-toggle,body.mobile-nav-open [data-mobile-nav-toggle]{background:#fff;color:#214f90}
  .sidebar nav,[data-mobile-nav-drawer]{position:fixed;z-index:72;top:66px;left:8px;right:8px;width:auto;max-height:calc(100dvh - 150px);display:none;grid-template-columns:1fr;gap:5px;padding:10px;border:1px solid rgba(141,173,219,.42);border-radius:13px;background:linear-gradient(180deg,#17366f,#112a59);box-shadow:0 18px 42px rgba(7,25,57,.32);overflow:auto;overscroll-behavior:contain}
  body.mobile-nav-open .sidebar nav{display:grid}
  body.mobile-nav-open [data-mobile-nav-drawer]{display:grid}
  .sidebar nav>.nav-item,.sidebar nav>.nav-group{width:100%;grid-column:auto}
  .sidebar nav>.nav-item,.sidebar .nav-group-toggle{min-height:42px;max-width:none;padding:7px 10px}
  .sidebar .nav-submenu{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin:4px 0 5px;padding:6px;border:1px solid rgba(177,200,235,.12);background:rgba(255,255,255,.035)}
  .sidebar .nav-subitem{min-height:36px;padding:7px!important}
  .mobile-nav-backdrop,[data-mobile-nav-backdrop]{position:fixed;z-index:65;inset:var(--mobile-shell-header) 0 calc(var(--mobile-shell-nav) + env(safe-area-inset-bottom,0px));display:block;border:0;background:rgba(9,22,45,.42);cursor:default}
  .mobile-nav-backdrop[hidden],[data-mobile-nav-backdrop][hidden]{display:none!important}
  main{grid-column:auto}
  .topbar{height:54px;min-height:54px;padding:8px 16px}
  .topbar .page-breadcrumb,.topbar p,.top-context,.topbar .current-account-control{display:none!important}
  .topbar h1{overflow:hidden;font-size:18px;text-overflow:ellipsis;white-space:nowrap}
  .page{padding-top:12px;padding-bottom:24px}
  [data-mobile-desktop-only]{display:none!important}
  .report-modal{z-index:1200!important}
  .report-modal-dialog{max-height:calc(100dvh - 20px)}
  .certificate-filter-panel{z-index:1200!important}

  [data-mobile-bottom-nav]{position:fixed;z-index:80;right:0;bottom:0;left:0;min-height:var(--mobile-shell-nav);display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:start;padding:6px max(8px,env(safe-area-inset-right,0px)) calc(5px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));border-top:1px solid #dbe4f0;background:rgba(255,255,255,.97);box-shadow:0 -9px 28px rgba(28,58,101,.1);backdrop-filter:blur(14px)}
  [data-mobile-bottom-nav]>button{position:relative;min-width:0;min-height:52px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:3px 2px;border:0;border-radius:11px;background:transparent;color:#78879a;cursor:pointer}
  [data-mobile-bottom-nav]>button>span{width:29px;height:26px;display:grid;place-items:center;border-radius:9px;font-size:13px;font-weight:800;line-height:1}
  [data-mobile-bottom-nav]>button>strong{overflow:hidden;max-width:100%;font-size:10px;font-weight:700;text-overflow:ellipsis;white-space:nowrap}
  [data-mobile-bottom-nav]>button.active{color:#1f559a}
  [data-mobile-bottom-nav]>button.active>span{background:#e5effc;color:#1f559a}
  [data-mobile-bottom-nav]>button.active:after{position:absolute;top:-6px;width:26px;height:3px;border-radius:0 0 3px 3px;background:#2e66ad;content:""}
  [data-mobile-bottom-nav]>button.mobile-bottom-primary>span{width:38px;height:38px;margin-top:-16px;border:4px solid #fff;border-radius:14px;background:linear-gradient(145deg,#3474c4,#1f559a);box-shadow:0 7px 16px rgba(32,83,153,.28);color:#fff;font-size:22px}
  [data-mobile-bottom-nav]>button.mobile-bottom-primary>strong{margin-top:-1px}

  [data-mobile-access-gate]{position:fixed;z-index:79;inset:var(--mobile-shell-header) 0 0;display:grid;place-items:center;padding:24px;background:linear-gradient(155deg,#edf4fc,#f9fbfe)}
  [data-mobile-access-gate][hidden]{display:none!important}
  [data-mobile-access-gate]>div{width:min(390px,100%);padding:28px 24px;border:1px solid #d4e1f1;border-radius:22px;background:#fff;box-shadow:0 18px 44px rgba(31,74,132,.14);text-align:center}
  [data-mobile-access-gate]>div>span{width:54px;height:54px;display:grid;place-items:center;margin:0 auto 16px;border-radius:17px;background:#e5effc;color:#205797;font-size:19px;font-weight:800}
  [data-mobile-access-gate] strong,[data-mobile-access-gate] p,[data-mobile-access-gate] small{display:block}
  [data-mobile-access-gate] strong{color:#1b385f;font-size:18px}
  [data-mobile-access-gate] p{margin:10px 0;color:#61738b;font-size:12px;line-height:1.65}
  [data-mobile-access-gate] small{padding-top:12px;border-top:1px solid #e6ebf2;color:#8a97a8;font-size:9px}
  body.mobile-access-blocked [data-mobile-bottom-nav]{display:none}

  [data-mobile-profile-panel]{position:fixed;z-index:90;inset:var(--mobile-shell-header) 0 calc(var(--mobile-shell-nav) + env(safe-area-inset-bottom,0px));display:flex;align-items:flex-end;padding:12px;background:rgba(8,24,49,.42);overflow:auto;overscroll-behavior:contain}
  [data-mobile-profile-panel][hidden]{display:none!important}
  .mobile-profile-sheet{position:relative;width:min(720px,100%);max-height:100%;margin:auto auto 0;padding:18px;border:1px solid #d8e3f0;border-radius:22px 22px 14px 14px;background:#f6f9fd;box-shadow:0 18px 44px rgba(14,42,81,.24);overflow:auto}
  .mobile-profile-close{position:absolute;z-index:2;top:26px;right:26px;width:32px;height:32px;border:1px solid rgba(255,255,255,.32);border-radius:50%;background:rgba(255,255,255,.15);color:#fff;font-size:20px;line-height:1;cursor:pointer}
  .mobile-profile-hero{display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:center;padding:18px 54px 18px 18px;border-radius:18px;background:linear-gradient(135deg,#193f7c,#2f6cb7);color:#fff}
  .mobile-profile-avatar{width:50px;height:50px;display:grid;place-items:center;grid-row:span 2;border:2px solid rgba(255,255,255,.58);border-radius:16px;background:rgba(255,255,255,.18);font-size:21px;font-weight:800}
  .mobile-profile-hero div{min-width:0}
  .mobile-profile-hero small,.mobile-profile-hero strong,.mobile-profile-hero div>span{display:block}
  .mobile-profile-hero small{color:#bfd8fa;font-size:8px}
  .mobile-profile-hero strong{overflow:hidden;margin-top:3px;font-size:18px;text-overflow:ellipsis;white-space:nowrap}
  .mobile-profile-hero div>span{margin-top:4px;color:#d9e7f9;font-size:10px}
  .mobile-profile-hero>b{grid-column:2;width:max-content;max-width:100%;padding:5px 9px;border:1px solid rgba(255,255,255,.22);border-radius:999px;background:rgba(255,255,255,.1);font-size:9px}
  .mobile-profile-status-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}
  .mobile-profile-status-grid article{min-width:0;display:flex;align-items:center;gap:10px;padding:13px;border:1px solid #dce6f2;border-radius:15px;background:#fff}
  .mobile-profile-status-grid article>i{width:34px;height:34px;flex:0 0 34px;display:grid;place-items:center;border-radius:11px;background:#e8f1fc;color:#235a9f;font-size:11px;font-style:normal;font-weight:800}
  .mobile-profile-status-grid article[data-connection-state="online"]>i{background:#e5f5ee;color:#147653}
  .mobile-profile-status-grid article[data-connection-state="offline"]>i{background:#fdeceb;color:#b33b3b}
  .mobile-profile-status-grid article[data-connection-state="warning"]>i{background:#fff3dd;color:#9c6508}
  .mobile-profile-status-grid article>div{min-width:0}
  .mobile-profile-status-grid small,.mobile-profile-status-grid strong,.mobile-profile-status-grid span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .mobile-profile-status-grid small{color:#8190a3;font-size:8px}
  .mobile-profile-status-grid strong{margin:3px 0;color:#173b70;font-size:12px}
  .mobile-profile-status-grid span{color:#7b8999;font-size:8px}
  .mobile-profile-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:12px}
  .mobile-profile-actions>button{min-height:48px;padding:10px 12px;border:1px solid #dce5ef;border-radius:12px;background:#fff;color:#263e5f;font-weight:700;text-align:left;cursor:pointer}
}

@media(max-width:520px){
  .mobile-profile-status-grid,.mobile-profile-actions{grid-template-columns:1fr}
}

@media(min-width:821px){
  [data-mobile-bottom-nav],[data-mobile-access-gate],[data-mobile-profile-panel]{display:none!important}
}

@media print{
  [data-mobile-bottom-nav],[data-mobile-access-gate],[data-mobile-profile-panel]{display:none!important}
}
