.mobile-rail{display:none}

@media(max-width:760px){
  :root,.large-text{--sidebar:calc(56px + env(safe-area-inset-left,0px))}
  .mobile-rail{position:fixed;inset:0 auto 0 0;display:flex;flex-direction:column;width:var(--sidebar);height:100dvh;padding-left:env(safe-area-inset-left,0px);background:var(--theme-surface,#fff);border-right:1px solid var(--theme-line,#e2e9e3);z-index:45}
  .mobile-rail-top{display:flex;align-items:center;justify-content:center;flex-shrink:0;min-height:66px;padding-top:env(safe-area-inset-top,0px);border-bottom:1px solid var(--theme-line,#edf1ed)}
  .mobile-rail-menu{display:grid;place-items:center;width:44px;height:44px;border-radius:12px;color:var(--theme-muted,#567360)}
  .mobile-rail-menu:hover,.mobile-rail-profile:hover{background:var(--theme-hover,#eaf3ed)}
  .mobile-rail-links{display:flex;flex-direction:column;gap:4px;min-height:0;flex:1;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:10px 4px}
  .mobile-rail-link{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:52px;flex-shrink:0;border-radius:11px;color:var(--theme-muted,#63756a);text-align:center}
  .mobile-rail-link:first-child{margin-top:auto}.mobile-rail-link:last-child{margin-bottom:auto}
  .mobile-rail-link>.icon{width:21px;height:21px;stroke-width:1.65}
  .mobile-rail-label{font-size:8px;font-weight:600;line-height:1.2;white-space:nowrap;letter-spacing:-.15px}
  .mobile-rail-link:hover{background:var(--theme-hover,#f2f6f2);color:var(--theme-accent,#236b53)}
  .mobile-rail-link.active{background:var(--theme-selected,#e8f2eb);color:var(--theme-accent,#21684d)}
  .mobile-rail-link.active:before{content:"";position:absolute;left:-4px;top:15px;bottom:15px;width:3px;border-radius:0 3px 3px 0;background:var(--theme-accent,#236b53)}
  .mobile-rail-link.active>.icon{stroke-width:2}
  .mobile-rail-count{position:absolute;right:3px;top:2px;min-width:16px;height:16px;display:grid;place-items:center;padding:0 3px;border-radius:6px;background:var(--theme-amber-soft,#f0dfcb);color:var(--theme-amber-text,#795124);font-size:9px;font-weight:700;border:2px solid var(--theme-line,#fff)}
  .mobile-rail-bottom{display:flex;justify-content:center;flex-shrink:0;border-top:1px solid var(--theme-line,#edf1ed);padding:9px 4px max(9px,env(safe-area-inset-bottom,0px))}
  .mobile-rail-profile{width:44px;height:44px;border-radius:14px;background:var(--theme-surface-muted,#f2f6f1);color:var(--theme-text,#3e6b4d);font-size:12px;font-weight:600}
  .mobile-rail :is(a,button):focus-visible{outline:2px solid var(--theme-accent-border,#236b53);outline-offset:-2px}
  .workspace{margin-left:var(--sidebar);min-width:0}
  .workspace .mobile-menu{display:none}
  .workspace .topbar{padding:0 12px;gap:6px}
  .workspace .topbar .breadcrumb{min-width:0}.workspace .breadcrumb strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .workspace .topbar-actions{gap:0;flex-shrink:0}
  .workspace main{padding:24px 14px 30px;min-width:0}
  .workspace .footer{padding:18px 14px}
  .workspace .demo-role-switch{min-width:0;flex-basis:100%}
  .workspace .demo-role-switch button{padding:9px 5px;gap:4px;min-height:40px}
  .workspace .demo-role-switch .icon{width:14px;height:14px}
  .workspace .fm-page-heading .heading-actions{flex-wrap:wrap}
  .workspace .fm-page-heading .heading-actions>.button{flex:1 1 120px}
  .workspace .fm-grid .fm-item{grid-template-columns:minmax(0,1fr)}
  .workspace .fm-grid .fm-item-actions{justify-content:flex-end;margin:0}
  .workspace .week-navigation{flex-wrap:wrap}
  .workspace .diary-result-heading{flex-wrap:wrap}
  .workspace .diary-metric{padding:13px 10px;grid-template-columns:minmax(0,1fr);gap:9px}
  .workspace .diary-metric strong{grid-column:1;grid-row:2}
  .workspace .metric-label{font-size:11px;overflow-wrap:anywhere}
  .workspace .demo-role-bar{padding:11px 9px}
  .workspace .dashboard-grid{grid-template-columns:minmax(0,1fr)}
  .workspace .dashboard-grid>*{min-width:0}
  .workspace .today-panel .section-heading{flex-wrap:wrap;gap:10px}
  .workspace .mini-calendar{grid-template-columns:repeat(7,minmax(0,1fr))}
  .workspace .calendar-day{width:100%;max-width:35px}
  .workspace .filter-tabs.compact{flex-wrap:wrap;max-width:100%}
}

@media(max-width:420px){
  .workspace main{padding-left:12px;padding-right:12px}
  .workspace .topbar .text-size{display:none}
  .workspace .demo-role-switch button{font-size:10px}
  .workspace .demo-role-switch .icon{display:none}
  .workspace .fm-grid{grid-template-columns:minmax(0,1fr)}
  .workspace .fm-grid .fm-item{grid-template-columns:minmax(0,1fr) auto;min-height:152px}
  .workspace .fm-section-heading h2{font-size:1.05rem}
  .workspace .fm-selection{flex-wrap:wrap}
  .workspace .diary-search{flex-basis:100%}
  .workspace .diary-filter-toggle{order:0;margin-top:0;margin-left:auto}
  .workspace .stat-item{padding:0 8px}
  .workspace .stat-item strong small{font-size:.6rem}
  .workspace .welcome-copy h2{font-size:1.7rem}
  .workspace .today-panel{padding-left:14px;padding-right:14px}
  .workspace .calendar-panel{padding:16px 12px}
  .workspace .holiday-note{padding:18px 14px;gap:10px}
  .workspace .calendar-legend{flex-wrap:wrap}
}
