.topbar,.admin-topbar{position:relative}.msh-nav-button{position:absolute;z-index:120;left:14px;top:50%;display:grid;align-content:center;gap:4px;width:44px;height:44px;margin:0;padding:11px;border:1px solid #d9e3ee;border-radius:14px;background:#f7fafd;color:#344054;transform:translateY(-50%);cursor:pointer;box-shadow:0 3px 10px rgba(27,48,75,.05)}.msh-nav-button:hover{background:#edf5ff;border-color:#bcd5ef}.msh-nav-button span{display:block;width:20px;height:2px;border-radius:2px;background:currentColor;transition:transform .2s ease,opacity .2s ease}.msh-nav-open .msh-nav-button span:nth-child(1){transform:translateY(6px) rotate(45deg)}.msh-nav-open .msh-nav-button span:nth-child(2){opacity:0}.msh-nav-open .msh-nav-button span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}.topbar>.brand{margin-left:48px}.admin-topbar>.back{display:none}.admin-topbar>.admin-brand{margin-left:58px}
.msh-nav-backdrop{position:fixed;z-index:9996;inset:0;display:block;border:0;background:rgba(17,28,45,.38);opacity:0;pointer-events:none;transition:opacity .22s ease;backdrop-filter:blur(3px)}.msh-nav-drawer{position:fixed;z-index:9997;inset:0 auto 0 0;display:flex;flex-direction:column;width:min(360px,calc(100vw - 28px));padding:18px;background:#f8fbfe;box-shadow:20px 0 70px rgba(15,31,52,.22);transform:translateX(-105%);transition:transform .24s cubic-bezier(.2,.8,.2,1);font-family:var(--msh-font-ui,"Inter","Noto Sans Thai",system-ui,sans-serif)}.msh-nav-open .msh-nav-backdrop{opacity:1;pointer-events:auto}.msh-nav-open .msh-nav-drawer{transform:translateX(0)}.msh-nav-open{overflow:hidden}
.msh-nav-drawer>header{display:flex;align-items:flex-start;justify-content:space-between;gap:15px;padding:5px 4px 18px;border-bottom:1px solid #e1e9f2}.msh-nav-drawer>header>div{display:grid;gap:2px}.msh-nav-drawer>header small{color:#667085;font-size:.78rem;font-weight:650}.msh-nav-drawer>header b{color:#172033;font-size:1.3rem}.msh-nav-drawer>header button{display:grid;place-items:center;width:42px;height:42px;padding:0;border:1px solid #f0c4bf;border-radius:50%;background:#fff6f4;color:#d92d20;font:inherit;font-size:1.8rem;line-height:1;cursor:pointer}
.msh-nav-drawer nav{display:grid;gap:8px;padding:18px 0}.msh-nav-drawer nav a{display:grid;grid-template-columns:48px minmax(0,1fr) 22px;align-items:center;gap:11px;min-height:66px;padding:9px 12px;border:1px solid transparent;border-radius:15px;color:#344054;text-decoration:none;transition:background .15s ease,border-color .15s ease,transform .15s ease}.msh-nav-drawer nav a:hover{background:#fff;border-color:#dce6f0;transform:translateX(2px)}.msh-nav-drawer nav a.active{background:#eaf3ff;border-color:#bed8f5;color:#1769c2}.msh-nav-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:13px;background:#edf2f7;color:#536176}.msh-nav-drawer a.active .msh-nav-icon{background:#fff;color:#1769c2}.msh-nav-icon svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.msh-nav-drawer nav a>span:nth-child(2){display:grid;gap:2px}.msh-nav-drawer nav a b{font-size:1rem}.msh-nav-drawer nav a small{overflow:hidden;color:#667085;font-size:.78rem;text-overflow:ellipsis;white-space:nowrap}.msh-nav-drawer nav a i{color:#98a2b3;font-size:1.45rem;font-style:normal}.msh-nav-drawer footer{margin-top:auto;padding:13px 4px 2px;color:#98a2b3;font-size:.72rem}.msh-nav-drawer [hidden]{display:none!important}.msh-nav-button:focus-visible,.msh-nav-drawer button:focus-visible,.msh-nav-drawer a:focus-visible{outline:3px solid rgba(40,125,232,.35);outline-offset:2px}
@media(max-width:760px){.msh-nav-button{left:8px;width:42px;height:42px;border-radius:13px}.topbar>.brand{margin-left:42px}.admin-topbar>.admin-brand{margin-left:50px}.msh-nav-drawer{padding:14px}.msh-nav-drawer nav a{min-height:64px}}

/* Shared navbar shell across calendar, leave, document registry and admin. */
.msh-page-topbar{position:sticky;top:0;z-index:900;display:grid;grid-template-columns:minmax(250px,1fr) auto minmax(250px,1fr);align-items:center;gap:16px;min-height:76px;margin:0;padding:9px clamp(14px,2.5vw,30px);border:0;border-bottom:1px solid rgba(207,219,234,.88);background:rgba(255,255,255,.94);box-shadow:0 5px 18px rgba(31,52,84,.055);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);font-family:var(--msh-font-ui,"Inter","Noto Sans Thai",system-ui,sans-serif)}
.msh-page-topbar>.brand{display:flex;align-items:center;gap:10px;min-width:0;margin-left:48px}
.msh-page-topbar .brand-logo{display:block;width:46px;height:46px;flex:0 0 46px;object-fit:contain}
.msh-page-topbar .brand .eyebrow{margin:0;color:#667085;font-size:.7rem;font-weight:600;line-height:1.15}
.msh-page-topbar .brand h1{overflow:hidden;margin:2px 0 0;color:#172033;font-size:1.23rem;font-weight:700;line-height:1.2;text-overflow:ellipsis;white-space:nowrap}
.msh-page-topbar>.top-actions{grid-column:3;display:flex;align-items:center;justify-content:flex-end;gap:10px;min-width:0}
.msh-page-topbar .identity,.msh-page-topbar .msh-standalone-user{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-left:auto;color:#344054}
.msh-page-topbar .identity>div,.msh-page-topbar .identity>.msh-user-copy,.msh-page-topbar .msh-standalone-user>.msh-user-copy{display:grid;min-width:0;text-align:right}
.msh-page-topbar .identity b,.msh-page-topbar .msh-user-copy b{overflow:hidden;max-width:220px;font-size:.86rem;text-overflow:ellipsis;white-space:nowrap}
.msh-page-topbar .identity span,.msh-page-topbar .identity small,.msh-page-topbar .msh-user-copy small{color:#667085;font-size:.7rem}
.msh-user-avatar{display:grid;place-items:center;width:46px;height:46px;flex:0 0 46px;overflow:hidden;border:1px solid #d6e0ec;border-radius:50%;background:#eaf3ff;color:#1769c2;font-weight:700}
.msh-user-avatar img{width:100%;height:100%;object-fit:cover}
body:not(.msh-calendar-route):not(.msh-navbar-action-route) .nav-create-wrap{display:none!important}
.doc-topbar,.admin-topbar{margin:0!important}
.admin-topbar>.brand{margin-left:48px!important}
.admin-topbar .top-logout{min-height:40px;padding:7px 13px;border:1px solid #dce5f0;border-radius:11px;background:#fff;color:#344054;cursor:pointer;font-weight:600}
@media(max-width:900px){.msh-page-topbar{grid-template-columns:minmax(210px,1fr) auto}.msh-page-topbar>.top-actions{grid-column:2}.msh-page-topbar .msh-user-copy,.msh-page-topbar .identity>b,.msh-page-topbar .identity>span{display:none}}
@media(max-width:760px){.msh-page-topbar{grid-template-columns:minmax(0,1fr) auto;min-height:64px;padding:7px 8px;gap:7px}.msh-page-topbar>.brand,.admin-topbar>.brand{gap:7px;margin-left:50px!important}.msh-page-topbar .brand-logo{width:38px;height:38px;flex-basis:38px}.msh-page-topbar .brand .eyebrow{display:none}.msh-page-topbar .brand h1{font-size:1rem}.msh-page-topbar>.top-actions{gap:6px}.msh-page-topbar .identity{display:none}.msh-user-avatar{width:42px;height:42px;flex-basis:42px}.admin-topbar .top-logout{padding:6px 9px;font-size:.78rem}}


/* Hamburger stability: preserve its centering against global button :active rules. */
html{scrollbar-gutter:stable}
.msh-nav-button:active:not(:disabled){transform:translateY(-50%) scale(.96)!important}
.msh-nav-button,.msh-nav-drawer{will-change:transform}
.msh-nav-open .msh-page-topbar{padding-right:clamp(14px,2.5vw,30px)}
@media(max-width:760px){.msh-nav-open .msh-page-topbar{padding-right:8px}}


/* Mobile navbar r158: one calm row, calendar-first. */
@media(max-width:760px){
  :root{
    --msh-fixed-nav-space:72px;
    --msh-nav-card-height:42px;
  }
  .msh-page-topbar{
    display:grid!important;
    grid-template-columns:minmax(72px,auto) minmax(88px,1fr) auto!important;
    grid-template-rows:52px!important;
    align-items:center!important;
    column-gap:7px!important;
    min-height:64px!important;
    height:64px!important;
    padding:6px max(8px,env(safe-area-inset-right)) 6px max(8px,env(safe-area-inset-left))!important;
    border-radius:0 0 18px 18px!important;
    overflow:visible!important;
  }
  .msh-page-topbar>.brand,
  .admin-topbar>.brand{
    grid-column:1!important;
    grid-row:1!important;
    justify-self:start!important;
    min-width:0!important;
    width:auto!important;
    gap:0!important;
    margin-left:48px!important;
  }
  .msh-page-topbar .brand-logo{
    width:34px!important;
    height:34px!important;
    flex:0 0 34px!important;
  }
  .msh-page-topbar .brand>div{display:none!important}
  .msh-nav-button{
    left:max(7px,env(safe-area-inset-left))!important;
    top:50%!important;
    width:42px!important;
    height:42px!important;
    padding:11px!important;
    border-radius:13px!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar>.nav-create-wrap{
    display:block!important;
    grid-column:2!important;
    grid-row:1!important;
    justify-self:stretch!important;
    width:100%!important;
    min-width:0!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-drop{
    width:100%!important;
    min-width:0!important;
    padding:0!important;
    border:0!important;
    border-radius:13px!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px!important;
    padding:8px 10px!important;
    border-radius:13px!important;
    overflow:hidden!important;
    color:transparent!important;
    font-size:0!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    box-shadow:0 4px 12px rgba(31,122,236,.16)!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button:after{
    content:"เพิ่มรายการ";
    color:#fff;
    font-size:14px;
    font-weight:700;
    line-height:1;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-file-button{display:none!important}
  .msh-page-topbar>.top-actions{
    grid-column:3!important;
    grid-row:1!important;
    justify-self:end!important;
    width:auto!important;
    min-width:0!important;
    gap:5px!important;
  }
  .msh-page-topbar .status-area{display:none!important}
  .msh-page-topbar #forceSync{
    display:grid!important;
    place-items:center!important;
    width:42px!important;
    min-width:42px!important;
    height:42px!important;
    min-height:42px!important;
    padding:0!important;
    border:1px solid rgba(120,140,170,.22)!important;
    border-radius:50%!important;
    background:rgba(255,255,255,.62)!important;
  }
  .msh-page-topbar #forceSync>span:last-child{display:none!important}
  .msh-page-topbar #forceSync .material-symbols-outlined{
    display:block!important;
    margin:0!important;
    font-size:22px!important;
  }
  .msh-page-topbar .user-menu-wrap{
    width:42px!important;
    height:42px!important;
    flex:0 0 42px!important;
  }
  .msh-page-topbar .user-menu-button{
    width:42px!important;
    height:42px!important;
    min-height:42px!important;
    padding:4px!important;
  }
  .msh-page-topbar .user-menu-button .avatar,
  .msh-page-topbar .user-menu-button .avatar-fallback{
    width:32px!important;
    height:32px!important;
    min-width:32px!important;
    min-height:32px!important;
    max-width:32px!important;
    max-height:32px!important;
    flex:0 0 32px!important;
  }
  body:not(.msh-calendar-route):not(.msh-navbar-action-route) .msh-page-topbar{
    grid-template-columns:minmax(72px,1fr) auto!important;
  }
  body:not(.msh-calendar-route):not(.msh-navbar-action-route) .msh-page-topbar>.top-actions{grid-column:2!important}
  .msh-nav-open .msh-page-topbar{padding-right:max(8px,env(safe-area-inset-right))!important}
}
@media(max-width:360px){
  .msh-page-topbar{grid-template-columns:minmax(68px,auto) minmax(72px,1fr) auto!important;column-gap:4px!important}
  .msh-page-topbar>.brand,.admin-topbar>.brand{margin-left:46px!important}
  .msh-page-topbar .brand-logo{width:30px!important;height:30px!important;flex-basis:30px!important}
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button:after{content:"เพิ่ม";font-size:13px}
  .msh-page-topbar #forceSync,.msh-page-topbar .user-menu-wrap,.msh-page-topbar .user-menu-button{width:40px!important;height:40px!important;min-width:40px!important}
}


/* Mobile create action r160: compact secondary pill. */
@media(max-width:760px){
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar>.nav-create-wrap{
    width:92px!important;
    max-width:92px!important;
    justify-self:center!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button{
    width:92px!important;
    max-width:92px!important;
    min-height:40px!important;
    height:40px!important;
    padding:7px 10px!important;
    border:1px solid #c9def6!important;
    border-radius:999px!important;
    background:#eaf4ff!important;
    box-shadow:none!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button:after{
    content:"＋ เพิ่ม"!important;
    color:#1769c2!important;
    font-size:13px!important;
    font-weight:700!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button:active{
    background:#dcecff!important;
    transform:scale(.97)!important;
  }
}
@media(max-width:360px){
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar>.nav-create-wrap,
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button{
    width:76px!important;
    max-width:76px!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .nav-create-button:after{content:"＋ เพิ่ม"!important;font-size:12px!important}
}


/* Intermediate navbar r165: keep calendar actions on one row before mobile mode. */
@media (min-width:761px) and (max-width:1280px){
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar{
    grid-template-columns:112px minmax(240px,1fr) auto!important;
    grid-template-rows:54px!important;
    min-height:72px!important;
    height:72px!important;
    gap:10px!important;
    padding:9px 14px!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar>.brand{
    grid-column:1!important;
    grid-row:1!important;
    width:auto!important;
    margin-left:50px!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar .brand-logo{
    width:40px!important;
    height:40px!important;
    flex-basis:40px!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar .brand>div{display:none!important}
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar>.nav-create-wrap{
    display:block!important;
    grid-column:2!important;
    grid-row:1!important;
    justify-self:center!important;
    width:min(100%,300px)!important;
    min-width:0!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar>.top-actions{
    grid-column:3!important;
    grid-row:1!important;
    justify-self:end!important;
    width:auto!important;
    min-width:0!important;
    gap:7px!important;
  }
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar .status-copy{display:none!important}
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar .user-menu-button{max-width:52px!important}
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar .me>span,
  body:is(.msh-calendar-route,.msh-navbar-action-route) .msh-page-topbar .chevron{display:none!important}
}
