/* Shared navigation controls; the desktop sidebar keeps its existing layout. */
.mobile-menu,.mobile-wordmark,.nav-close{display:none}
.topbar-context{display:flex;align-items:center;min-width:0}
body.navigation-open,body.dialog-open{overflow:hidden}
.overview-screen .sidebar{visibility:hidden;pointer-events:none}
.overview-screen.nav-open .sidebar{visibility:visible;pointer-events:auto}
.overview-screen .nav-close{display:grid}
.nav-close{position:absolute;right:10px;top:16px;place-items:center;width:44px;height:44px;border-radius:10px;background:#f4f6fc;color:#52617b;font-size:28px}
.overview-screen .sidebar .brand{padding-right:30px}
.nav-backdrop{display:none}
.overview-screen .nav-backdrop{display:block}
.overlay{z-index:40}

@media(max-width:780px){
  .portal-shell{min-height:100vh;min-height:100dvh}
  .portal-shell .sidebar{position:fixed;inset:0 auto 0 0;width:min(300px,calc(100vw - 48px));height:100vh;height:100dvh;display:flex;flex-direction:column;gap:0;padding:24px 18px max(16px,env(safe-area-inset-bottom));border:0;background:#fff;color:var(--ink);z-index:31;overflow-y:auto;overscroll-behavior:contain;transform:translateX(-100%);visibility:hidden;pointer-events:none;box-shadow:12px 0 40px #08172d26}
  .portal-shell.nav-open .sidebar{transform:translateX(0);visibility:visible;pointer-events:auto}
  .portal-shell .nav-backdrop{display:block;z-index:30;touch-action:none}
  .portal-shell .nav-close{display:grid;top:16px;right:14px}
  .portal-shell .sidebar .brand{padding:0 38px 0 8px;min-height:44px;font-size:23px;gap:10px}
  .portal-shell .sidebar .brand-mark{width:38px;height:38px;flex-shrink:0}
  .portal-shell .sidebar .workspace{display:none}
  .portal-shell .sidebar .nav-label{display:block;margin:24px 0 9px;padding:0 12px;font-size:11px}
  .portal-shell .sidebar nav{display:flex;flex-direction:column;overflow:visible;gap:5px;margin:0;flex-shrink:0}
  .portal-shell .sidebar nav button{min-height:46px;width:100%;padding:11px 13px;gap:13px;font-size:14px;white-space:normal;line-height:1.5}
  .portal-shell .sidebar .nav-icon{font-size:19px;width:20px;flex-shrink:0}
  .portal-shell .sidebar .sidebar-bottom{display:block;padding-top:24px;margin-top:auto}
  .portal-shell .sidebar .help-card{display:none}
  .portal-shell .sidebar .profile{min-height:58px;font-size:14px}
  .portal-shell .sidebar .profile small{font-size:11px}
  .sidebar .profile>span:nth-child(2){min-width:0;overflow-wrap:anywhere}
  .portal-shell main{margin-left:0;min-width:0}
  .mobile-menu{display:grid;place-items:center;width:44px;height:44px;flex-shrink:0;border:1px solid #e6eaf4;border-radius:10px;background:#fff;color:#5268a1;font-size:22px}
  .mobile-wordmark{display:inline;font-weight:700;font-size:17px;color:#263652;white-space:nowrap}
  .topbar{position:sticky;top:0;z-index:12;height:68px;padding:0 16px;gap:10px;background:#fff}
  .topbar-context{gap:10px;overflow:hidden}
  .topbar-breadcrumb{font-size:12px;color:#7e8ba1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .topbar-breadcrumb>.muted,.topbar-breadcrumb>.slash{display:none}
  .top-actions{flex-shrink:0}
  .top-actions>.text-button{font-size:12px;min-height:44px;padding:8px 4px}
  .top-actions>.button{min-height:44px}
  .content{padding:24px 16px 0}
  .page-heading{align-items:flex-start;flex-wrap:wrap;gap:14px;margin-bottom:24px}
  .page-heading>div{flex:1 1 190px;min-width:0}
  .page-heading>.button{min-height:44px;flex-shrink:0;margin-top:16px}
  h1{font-size:26px;line-height:1.3}
  .eyebrow{font-size:8px;letter-spacing:1.5px}
  .subtitle{font-size:12px;line-height:1.8;color:#7c89a0}
  .button,.secondary{min-height:44px;font-size:13px;padding:10px 14px}
  .text-button,.request-button,.open-link{min-height:44px;display:inline-flex;align-items:center;justify-content:center;font-size:13px;padding:10px 12px}
  .button.small,.secondary.small{min-height:44px;font-size:12px}
  .filter-bar{flex-wrap:wrap;gap:12px}
  .filter-bar .search{flex:1 1 100%;max-width:none;min-width:0}
  .filter-bar>.portal-select{max-width:none;margin-left:0;min-width:160px}
  .search{padding:0 13px;min-width:0}
  .search input{font-size:16px;min-height:46px;min-width:0}
  .search input::placeholder{font-size:13px}
  .portal-select-trigger,.filter-bar .portal-select-trigger,.section-heading .portal-select-trigger{min-height:44px;font-size:13px}
  .portal-select-menu{font-size:14px}
  .portal-select-option{min-height:44px}
  .tabs{gap:6px;margin:14px 0 22px}
  .tabs button{min-height:44px;font-size:13px;padding:10px 14px;overflow-wrap:anywhere;max-width:100%}
  .section-heading{flex-wrap:wrap;gap:12px;align-items:center}
  .section-heading h2{font-size:17px;min-width:0}
  .section-heading>.muted{font-size:12px;line-height:1.6}
  .section-heading .compact{max-width:none;flex:1 1 100%}
  .site-grid{grid-template-columns:1fr;gap:14px}
  .site-card{padding:20px;min-width:0}
  .site-card .resource-icon{width:42px;height:42px;flex-shrink:0;font-size:21px}
  .site-card .tag{white-space:normal;overflow-wrap:anywhere;font-size:11px;line-height:1.6;max-width:65%}
  .site-card .icon-button{min-width:44px;min-height:44px}
  .site-card h3{font-size:16px;overflow-wrap:anywhere}
  .site-card>p{font-size:13px;line-height:1.8;min-height:0;overflow-wrap:anywhere}
  .card-bottom{margin-top:16px;padding-top:8px;gap:12px}
  .card-bottom .open-link,.card-bottom .text-button{font-size:13px}
  .access-label{font-size:12px}
  .empty{font-size:13px;line-height:1.8;padding:36px 20px}
  .notice,.hint,.library-help{overflow-wrap:anywhere;font-size:12px;line-height:1.8}
  .notice{padding:14px}
  .section-foot{font-size:11px;line-height:1.7}
  .binding-panel{padding:18px}
  .binding-panel label{font-size:14px}
  .form-grid{grid-template-columns:minmax(0,1fr);gap:0}
  .request-row{align-items:center;overflow-wrap:anywhere;font-size:14px}
  .request-row .grow{flex:1 1 calc(100% - 60px);min-width:0}
  .request-row>div:first-child{min-width:0;flex-basis:100%}
  .request-row p,.request-row small{font-size:12px}
  .request-row .tag{white-space:normal}
  .subheading{font-size:14px}
  .status{font-size:12px;white-space:normal;max-width:100%;line-height:1.6}
  footer{gap:16px;font-size:10px;line-height:1.7;flex-wrap:wrap;padding-bottom:max(24px,env(safe-area-inset-bottom))}

  /* Administration tables become labelled cards instead of wide scroll areas. */
  .table-wrap:not(.library-table){background:transparent;border:0;border-radius:0;overflow:visible}
  .table-wrap:not(.library-table) table,.table-wrap:not(.library-table) tbody{display:block;width:100%;min-width:0}
  .table-wrap:not(.library-table) thead{display:none}
  .table-wrap:not(.library-table) tr{display:block;margin-bottom:12px;padding:6px 0;border:1px solid #e7ebf3;border-radius:12px;background:#fff;overflow:hidden}
  .table-wrap:not(.library-table) td{display:block;position:relative;padding:10px 14px 10px 100px;min-height:42px;border:0;max-width:none;width:auto;font-size:13px;white-space:normal;overflow-wrap:anywhere;line-height:1.7}
  .table-wrap:not(.library-table) td:before{content:attr(data-label);position:absolute;left:14px;top:10px;width:76px;color:#8b97ac;font-size:12px}
  .table-wrap:not(.library-table) td strong{font-size:14px;overflow-wrap:anywhere}
  .table-wrap:not(.library-table) td small{font-size:12px;max-width:none}
  .table-wrap:not(.library-table) td .text-button{padding:8px 9px}
  .table-wrap:not(.library-table) td code{font-size:12px;word-break:break-all}

  /* Document categories keep their hierarchy, with each document below as a card. */
  .library-toolbar{gap:12px}
  .library-summary{flex-wrap:wrap;gap:8px}
  .library-summary strong{font-size:16px}
  .library-summary>span:last-child{font-size:12px}
  .library-toolbar>div:last-child{gap:6px;flex-wrap:wrap}
  .library-toolbar .text-button{padding:10px 8px;font-size:12px}
  .library-toolbar .button{margin-left:auto;padding:10px;font-size:12px}
  .library-table{overflow:visible;border-radius:12px}
  .library-table table,.library-table tbody{display:block;width:100%;min-width:0}
  .library-table thead{display:none}
  .library-table .category-row{display:block;background:#f2f5fc;border-top:1px solid #e4eaf5;border-radius:10px;overflow:hidden}
  .library-table .category-row>td{display:none}
  .library-table .category-row>td:nth-child(2){display:block;border:0;padding:8px 12px;background:transparent}
  .category-row-title{min-width:0;gap:4px;padding-left:calc(min(var(--tree-depth),2)*10px)}
  .category-toggle{min-height:44px;flex:1;min-width:0;gap:8px}
  .category-toggle strong{font-size:14px;overflow-wrap:anywhere}
  .category-chevron,.folder-icon,.category-count{flex-shrink:0}
  .category-count{font-size:11px}
  .category-add{width:44px;height:44px;flex-shrink:0;font-size:23px}
  .library-table .document-child{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px 10px;padding:16px 14px;border-bottom:1px solid #e9edf5}
  .library-table .document-child>td{display:block;padding:0;border:0;min-width:0;background:transparent;font-size:12px}
  .library-table .document-child>.number{display:none}
  .library-table .document-child>td:nth-child(2){grid-column:1/-1;margin-bottom:3px}
  .library-table .document-child>td:nth-child(3){align-self:center;color:#8d99ac}
  .library-table .document-child>td:nth-child(4){justify-self:end}
  .library-table .document-child>td:nth-child(6){justify-self:end}
  .tree-document{min-width:0;gap:10px;align-items:flex-start;padding-left:calc(min(var(--tree-depth),2)*10px)}
  .tree-document>div{min-width:0}
  .tree-document .doc-icon{width:30px;height:34px}
  .tree-document strong{font-size:14px;line-height:1.7;overflow-wrap:anywhere}
  .tree-document small{font-size:12px;line-height:1.7;max-width:none}
  .tree-elbow{display:none}
  .document-child .open-link,.document-child .request-button{min-height:44px;padding:9px 12px;background:#eef2ff;border-radius:8px;font-size:13px}

  .overlay{padding:12px;overscroll-behavior:contain}
  .modal,.modal.wide{width:100%;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);padding:26px 20px;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  .modal h2{padding-right:30px;font-size:22px}
  .modal .close{width:44px;height:44px;right:8px;top:8px}
  .modal label{font-size:14px;line-height:1.6}
  .modal label input,.modal label select,.modal label textarea,.binding-panel input{font-size:16px;min-height:46px}
  .modal label small{font-size:12px}
  .modal-actions{position:sticky;bottom:-26px;padding:14px 0 22px;margin-bottom:-20px;background:#fff;border-top:1px solid #eef1f7;z-index:1}
  .modal-actions>button{flex:1;min-height:46px}
  .auth-tabs button{font-size:14px;min-height:44px}
  .feishu-actions{flex-wrap:wrap;gap:10px}
  .feishu-actions a{min-width:120px}
  .welcome{padding:32px 20px;min-height:0}
  .welcome h2{font-size:23px;overflow-wrap:anywhere}
  .welcome-tiles{flex-wrap:wrap;gap:12px;font-size:12px;margin-top:24px}
  .toast{bottom:max(20px,env(safe-area-inset-bottom));font-size:13px}

  .overview-screen .content{padding:0 16px}
  .home-toolbar{padding:16px 0}
  .home-menu-button{width:44px;height:44px;flex-shrink:0}
  .home-profile{max-width:140px;overflow:hidden;white-space:nowrap;font-size:12px;min-height:44px}
  .home-profile>span{flex-shrink:0}
  .home-exit{min-width:44px;min-height:44px;font-size:12px}
  .home-center h1{font-size:24px}
  .home-search input{font-size:16px}
  .home-search input::placeholder{font-size:13px}
  .home-search-submit{min-width:70px;font-size:12px}
  .home-categories{gap:8px}
  .home-categories button{min-height:36px;font-size:11px}
  .shortcut-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:20px 12px}
  .shortcut-icon{width:46px;height:46px}
  .shortcut-title{font-size:12px}
  .home-all-sites{min-height:44px;font-size:12px}
  .home-recent{padding:18px 14px}
  .home-section-heading{gap:6px}
  .home-section-heading h2{font-size:16px;white-space:nowrap}
  .home-view-all{min-height:44px;font-size:12px}
  .recent-tabs{flex-wrap:wrap;white-space:normal;overflow:visible;gap:0 16px}
  .recent-tabs button{min-height:44px;font-size:12px;max-width:100%;overflow-wrap:anywhere;padding:10px 0}
  .recent-card{min-height:80px;padding:12px 10px;gap:8px}
  .recent-card strong{font-size:12px;white-space:normal;overflow-wrap:anywhere;line-height:1.6}
  .recent-card small{font-size:10px}
  .recent-footnote{font-size:11px;line-height:1.8}
  .recent-empty strong,.recent-empty p{font-size:12px}
  .recent-empty button{min-height:44px;font-size:12px}
}

@media(min-width:601px) and (max-width:780px){.site-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.shortcut-grid{grid-template-columns:repeat(6,minmax(0,1fr))}}
@media(max-width:360px){.topbar-breadcrumb{display:none}.home-profile{max-width:88px}.home-toolbar>div{gap:8px}.home-wordmark{font-size:17px}.home-center h1{font-size:21px;letter-spacing:0}.recent-grid{grid-template-columns:1fr}.page-heading>.button{margin-top:0}}
@media(prefers-reduced-motion:reduce){.portal-shell .sidebar{transition:none}}
