:root{--ku-navy:#061529;--ku-navy2:#0b3550;--ku-teal:#65d7d9;--ku-blue:#70b7ff;--ku-side:#fbfdfc;--ku-line:#d7e5e2;--ku-ink:#17344b;--ku-green:#315f63;--ku-active:#123243}
*{box-sizing:border-box}
#sharedHeader.shared-header{height:104px!important;background:linear-gradient(90deg,var(--ku-navy) 0%,#06162b 72%,var(--ku-navy2) 100%)!important;color:#fff!important;display:flex!important;align-items:center!important;justify-content:space-between!important;padding:0 28px!important;border:0!important;border-bottom:1px solid rgba(255,255,255,.08)!important;position:relative!important;z-index:200!important;width:100%!important}
.shared-brand{display:flex;align-items:center;gap:16px;text-decoration:none;color:#fff;min-width:0}
.shared-logo{width:58px;height:58px;border-radius:18px;background:linear-gradient(135deg,#55cfda,#73b8ff);display:grid;place-items:center;color:#07192d;font-weight:900;font-size:24px;flex:0 0 auto}
.shared-brandname{font-size:23px;font-weight:900;white-space:nowrap;letter-spacing:.1px}.shared-brandname span{color:#82e4d7}
.shared-cta{height:62px;padding:0 25px;border-radius:18px;background:linear-gradient(135deg,#61d8dc,#72b7ff);color:#0b2a3d;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;font-weight:900;font-size:17px;white-space:nowrap}
#sharedSidebar.shared-sidebar{background:var(--ku-side)!important;color:var(--ku-green)!important;border-right:1px solid var(--ku-line)!important;border-radius:0!important;padding:18px 14px 28px!important;position:sticky!important;top:0!important;height:calc(100vh - 104px)!important;min-height:0!important;overflow:hidden!important;white-space:nowrap!important;z-index:120!important;transition:width .22s ease,padding .22s ease!important;width:286px!important}
.shared-sidebar-controls{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;padding:0 0 18px;border-bottom:1px solid var(--ku-line);position:sticky;top:0;background:var(--ku-side);z-index:4}
.shared-control{height:58px;border:1px solid #cfe0dd;background:#fff;color:var(--ku-green);border-radius:15px;display:grid;place-items:center;cursor:pointer}.shared-control svg{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.shared-menu-scroll{height:calc(100% - 78px);overflow-y:auto;overflow-x:visible;padding:18px 0 96px;overscroll-behavior:contain;scrollbar-width:none}.shared-menu-scroll::-webkit-scrollbar{display:none}
.shared-group{margin-bottom:12px}.shared-group-head{min-height:58px;border-radius:16px;padding:0 16px;display:flex;align-items:center;gap:13px;font-weight:800;font-size:17px;background:#eef6f4;cursor:pointer}.shared-group-head .shared-arrow{margin-left:auto;font-size:15px}.shared-group-icon,.shared-menu-icon{width:28px;height:28px;display:grid;place-items:center;flex:0 0 28px}.shared-group-icon svg,.shared-menu-icon svg{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.shared-group-body{display:none;margin:7px 0 0 42px;padding-left:11px;border-left:2px solid #d7e9e5}.shared-group.open .shared-group-body{display:grid;gap:6px}.shared-menu-link{min-height:52px;border-radius:16px;padding:0 15px;display:flex;align-items:center;gap:13px;color:var(--ku-green);text-decoration:none;font-weight:800;font-size:16px}.shared-menu-link:hover{background:#f0f6f4}.shared-menu-link.active{background:var(--ku-active);color:#fff;box-shadow:0 5px 0 rgba(18,50,67,.13)}
.shared-rail-expand{display:none;position:absolute;right:-56px;top:18px;width:58px;height:58px;border-radius:15px;border:1px solid #cfe0dd;background:#fff;color:var(--ku-green);z-index:300;place-items:center;cursor:pointer;box-shadow:4px 4px 12px rgba(37,78,82,.08)}.shared-rail-expand svg{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.shared-tooltip{position:fixed;z-index:9999;display:none;pointer-events:none;padding:9px 12px;border-radius:10px;background:#123243;color:#fff;font-size:14px;font-weight:800;white-space:nowrap;box-shadow:0 8px 24px rgba(15,40,52,.22)}.shared-tooltip.show{display:block}
body.shared-rail #sharedSidebar.shared-sidebar{width:86px!important;padding-left:10px!important;padding-right:10px!important;overflow:visible!important}
body.shared-rail .shared-sidebar-controls{grid-template-columns:1fr}.shared-sidebar-controls .rail-only-hide{display:grid}
body.shared-rail .shared-sidebar-controls .rail-only-hide{display:none!important}
body.shared-rail .shared-control{width:58px;margin:0 auto}
body.shared-rail .shared-menu-scroll{overflow-y:auto;overflow-x:visible;padding-bottom:110px}
body.shared-rail .shared-group{margin-bottom:8px}
body.shared-rail .shared-group-head{width:58px;height:58px;min-height:58px;padding:0;margin:0 auto;background:transparent;justify-content:center}
body.shared-rail .shared-group.active-group .shared-group-head{background:#eef6f4}
body.shared-rail .shared-group-text,body.shared-rail .shared-arrow{display:none!important}
body.shared-rail .shared-group-body{
  display:none!important;
  margin:6px 0 0!important;
  padding:0!important;
  border:0!important;
  gap:6px
}
body.shared-rail .shared-group.open .shared-group-body{display:grid!important}
body.shared-rail .shared-menu-link{width:58px;height:58px;min-height:58px;padding:0;margin:0 auto;justify-content:center;border-radius:16px}
body.shared-rail .shared-menu-text{display:none!important}
body.shared-rail .shared-rail-expand{display:grid}
/* normalize page wrappers so all app pages share the same navigation width */
.shell,.app,.layout{grid-template-columns:286px minmax(0,1fr)!important;gap:0!important;margin-top:0!important}
body.shared-rail .shell,body.shared-rail .app,body.shared-rail .layout{grid-template-columns:86px minmax(0,1fr)!important}
.page-shell{padding-top:0!important}
@media(max-width:760px){#sharedHeader.shared-header{height:88px!important;padding:0 14px!important}.shared-logo{width:48px;height:48px;border-radius:15px}.shared-brandname{font-size:18px}.shared-cta{height:48px;padding:0 14px;font-size:14px;border-radius:14px}#sharedSidebar.shared-sidebar{height:calc(100vh - 88px)!important}.shared-brandname{max-width:230px;overflow:hidden;text-overflow:ellipsis}.shell,.app,.layout{grid-template-columns:86px minmax(0,1fr)!important}body:not(.shared-expanded-mobile){--noop:1}#sharedSidebar.shared-sidebar{width:86px!important;padding-left:10px!important;padding-right:10px!important}.shared-sidebar-controls{grid-template-columns:1fr}.shared-sidebar-controls .rail-only-hide{display:none!important}.shared-group-text,.shared-arrow,.shared-menu-text{display:none!important}.shared-group-head,.shared-menu-link{width:58px!important;height:58px!important;min-height:58px!important;padding:0!important;margin:0 auto!important;justify-content:center!important}.shared-group-body{display:none!important;margin:6px 0 0!important;padding:0!important;border:0!important}
.shared-group.open .shared-group-body{display:grid!important}.shared-rail-expand{display:none!important}}

/* v34: align hamburger and rail expand controls on the same horizontal row */
body.shared-rail #sharedSidebar.shared-sidebar{position:sticky!important}
body.shared-rail .shared-sidebar-controls{
  min-height:76px;
  align-items:start;
}
body.shared-rail .shared-control#hamb{
  height:58px!important;
}
body.shared-rail .shared-rail-expand{
  top:18px!important;
  right:-68px!important;
  width:58px!important;
  height:58px!important;
  border-radius:15px!important;
  border:1px solid #cfe0dd!important;
  border-left:1px solid #cfe0dd!important;
  box-shadow:0 6px 18px rgba(37,78,82,.10)!important;
}

/* v35: rail mode preserves group expand/collapse state and toggle-all behavior */
body.shared-rail .shared-sidebar-controls{
  grid-template-columns:1fr 1fr!important;
}
body.shared-rail #toggleAll{
  display:grid!important;
  width:58px!important;
  margin:0 auto!important;
}
body.shared-rail #compactBtn{
  display:none!important;
}
body.shared-rail .shared-group-body{
  display:none!important;
}
body.shared-rail .shared-group.open .shared-group-body{
  display:grid!important;
}

@media(max-width:760px){
  body.shared-rail .shared-rail-expand{display:none!important}
  body.shared-rail .shell>main,
  body.shared-rail .app>main,
  body.shared-rail .layout>main,
  body.shared-rail .shell>.main,
  body.shared-rail .app>.main,
  body.shared-rail .layout>.content{padding-left:0!important}
}

/* v37: restore TSMC-style compact sidebar behavior.
   Rail mode = vertical controls, current group's children only, other groups collapsed. */
body.shared-rail #sharedSidebar.shared-sidebar{
  width:86px!important;
  padding-left:10px!important;
  padding-right:10px!important;
  overflow:visible!important;
}
body.shared-rail .shared-sidebar-controls{
  display:grid!important;
  grid-template-columns:58px!important;
  grid-auto-rows:58px!important;
  justify-content:center!important;
  align-items:center!important;
  row-gap:12px!important;
  min-height:auto!important;
  padding-bottom:18px!important;
  position:relative!important;
}
body.shared-rail #hamb,
body.shared-rail #toggleAll{
  display:grid!important;
  width:58px!important;
  height:58px!important;
  margin:0 auto!important;
}
body.shared-rail #compactBtn{display:none!important}

/* Expand-full-menu button sits to the right of the rail's first row. */
body.shared-rail .shared-rail-expand{
  display:grid!important;
  position:absolute!important;
  left:calc(100% + 22px)!important;
  right:auto!important;
  top:18px!important;
  width:58px!important;
  height:58px!important;
  margin:0!important;
  border-radius:15px!important;
  border:1px solid #cfe0dd!important;
  background:#fff!important;
  z-index:350!important;
  box-shadow:0 6px 18px rgba(37,78,82,.10)!important;
}

/* Rail state never changes which groups are open. */
body.shared-rail .shared-group-body{display:none!important}
body.shared-rail .shared-group.open .shared-group-body{display:grid!important}

/* Keep main content clear of the side expand button, without changing app behavior. */
body.shared-rail .shell>main,
body.shared-rail .app>main,
body.shared-rail .layout>main,
body.shared-rail .shell>.main,
body.shared-rail .app>.main,
body.shared-rail .layout>.content{
  padding-left:78px!important;
}

@media(max-width:760px){
  body.shared-rail .shared-rail-expand{display:none!important}
  body.shared-rail .shell>main,
  body.shared-rail .app>main,
  body.shared-rail .layout>main,
  body.shared-rail .shell>.main,
  body.shared-rail .app>.main,
  body.shared-rail .layout>.content{padding-left:0!important}
}

/* v38: admin default visual state = full sidebar, only current group expanded */
body[data-page="admin"]:not(.shared-rail) #sharedSidebar.shared-sidebar{
  width:286px;
}


/* v39: in rail mode, make hamburger and expand-full-menu buttons equally spaced
   from the center divider by positioning the expand button from the sidebar edge,
   not from the inner controls box. */
body.shared-rail #sharedSidebar.shared-sidebar{
  position:sticky!important;
  --rail-sidebar-width:86px;
  --rail-control-size:58px;
  --rail-edge-gap:14px;
}
body.shared-rail .shared-rail-expand{
  left:calc(var(--rail-sidebar-width) + var(--rail-edge-gap))!important;
  right:auto!important;
  top:18px!important;
}


/* v40: optical mirror spacing around the sidebar divider.
   Hamburger right edge -> divider = 12px
   Divider -> expand button left edge = 12px */
body.shared-rail #sharedSidebar.shared-sidebar{
  --rail-sidebar-width:86px;
  --rail-control-size:58px;
  --rail-mirror-gap:12px;
}

/* Center the left control precisely inside the 86px rail:
   (86 - 58) / 2 = 14px; then use optical 12px on the outside button
   to compensate for the expand button border/shadow weight. */
body.shared-rail #hamb{
  width:58px!important;
  height:58px!important;
  justify-self:center!important;
  margin:0!important;
}

body.shared-rail .shared-rail-expand{
  left:calc(100% + var(--rail-mirror-gap))!important;
  right:auto!important;
  top:18px!important;
  width:58px!important;
  height:58px!important;
  margin:0!important;
}

/* Remove lateral shadow bias so the two gaps read equally. */
body.shared-rail .shared-rail-expand{
  box-shadow:0 6px 18px rgba(37,78,82,.10)!important;
}

/* v41: compact navigation keeps parent/child hierarchy visible. */
#sharedSidebar.shared-sidebar{display:flex!important;flex-direction:column!important}
.shared-sidebar-controls{flex:0 0 auto}
.shared-menu-scroll{height:auto!important;flex:1 1 auto;min-height:0;padding-bottom:30px!important}
.shared-group:not(.open) .shared-arrow{transform:rotate(180deg)}
body.shared-rail .shared-group{margin-bottom:16px!important}
body.shared-rail .shared-group-head{background:#edf5f2!important;border:1px solid #dfebe6;border-radius:15px!important;width:58px!important;height:54px!important;min-height:54px!important;position:relative}
body.shared-rail .shared-group-head:after{content:'›';position:absolute;right:3px;bottom:2px;font-size:13px;color:#668b86;transform:rotate(0)}
body.shared-rail .shared-group.open .shared-group-head:after{transform:rotate(90deg)}
body.shared-rail .shared-group-body{margin:8px 0 0 13px!important;padding:0 0 3px 9px!important;border-left:2px solid #c8ddd5!important;gap:7px!important}
body.shared-rail .shared-menu-link{width:40px!important;height:40px!important;min-height:40px!important;border-radius:11px!important;margin:0!important;position:relative;background:#f2f7f5;color:#62817f}
body.shared-rail .shared-menu-link:before{content:'';position:absolute;left:-10px;top:19px;width:9px;height:1px;background:#c8ddd5}
body.shared-rail .shared-menu-icon,body.shared-rail .shared-menu-icon svg{width:21px!important;height:21px!important;flex-basis:21px!important}
body.shared-rail .shared-menu-link.active{background:var(--ku-active)!important;color:white!important;box-shadow:0 3px 0 #12324320}
.shared-control:focus-visible,.shared-group-head:focus-visible,.shared-menu-link:focus-visible{outline:3px solid #3093cf;outline-offset:2px}
@media(max-width:760px){
 #sharedHeader.shared-header{padding:0 10px!important;gap:8px}.shared-brand{gap:8px}.shared-brandname{font-size:15px;max-width:150px}.shared-logo{width:38px;height:38px}.shared-cta{font-size:12px;padding:0 10px}
 body.shared-rail .shell>main,body.shared-rail .app>main,body.shared-rail .layout>main{padding-left:14px!important}
 body:not(.shared-rail) #sharedSidebar.shared-sidebar{position:fixed!important;top:88px!important;left:0;width:286px!important;padding:18px 14px!important;box-shadow:8px 0 30px #001a3033}
 body:not(.shared-rail) .shared-sidebar-controls{grid-template-columns:1fr 1fr 1fr!important}
 body:not(.shared-rail) .shared-sidebar-controls .rail-only-hide{display:grid!important}
 body:not(.shared-rail) .shared-group-text,body:not(.shared-rail) .shared-arrow,body:not(.shared-rail) .shared-menu-text{display:block!important}
 body:not(.shared-rail) .shared-group-head,body:not(.shared-rail) .shared-menu-link{width:auto!important;padding:0 15px!important;justify-content:flex-start!important}
 body:not(.shared-rail) .shared-group-body{margin:7px 0 0 42px!important;padding-left:11px!important;border-left:2px solid #d7e9e5!important}
}
