:root {
  --intranet-header-height: 58px;
  --intranet-drawer-width: 286px;
  --intranet-navy: #082743;
  --intranet-navy-deep: #051b30;
  --intranet-blue: #135fc5;
}

body.has-intranet-shell {
  padding-top: 0 !important;
  transition: padding-left .22s ease;
}

body.has-intranet-shell.intranet-shell-authenticated {
  padding-top: var(--intranet-header-height) !important;
}

.intranet-global-header,
.intranet-global-drawer,
.intranet-drawer-backdrop { display: none; }

body.intranet-shell-authenticated .intranet-global-header,
body.intranet-shell-authenticated .intranet-global-drawer { display: flex; }

.intranet-global-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10020;
  height: var(--intranet-header-height);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 18px;
  color: #13233a;
  background: rgba(255, 255, 255, .98);
  border-bottom: 1px solid #d8e1eb;
  box-shadow: 0 3px 16px rgba(15, 35, 55, .07);
}

.intranet-header-left,
.intranet-header-account,
.intranet-profile-link { display: flex; align-items: center; }
.intranet-header-left { min-width: 0; gap: 10px; }
.intranet-header-account { gap: 8px; }

.intranet-drawer-toggle,
.intranet-logout-button,
.intranet-header-home {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid #ccd8e5;
  border-radius: 7px;
  background: #fff;
  color: #13233a;
  cursor: pointer;
}
.intranet-drawer-toggle:hover,
.intranet-logout-button:hover,
.intranet-header-home:hover { background: #eef6ff; border-color: #8db7e8; }
.intranet-drawer-toggle:focus-visible,
.intranet-logout-button:focus-visible,
.intranet-header-home:focus-visible,
.intranet-profile-link:focus-visible { outline: 3px solid rgba(19, 95, 197, .25); outline-offset: 2px; }
.intranet-drawer-toggle span { width: 21px; height: 3px; border-radius: 3px; background: currentColor; }
.intranet-drawer-toggle { align-content: center; gap: 4px; padding: 0; }
.intranet-header-home img { width: 30px; height: 30px; object-fit: contain; }
.intranet-logout-button svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.intranet-module-identity { display: flex; min-width: 0; align-items: baseline; gap: 8px; white-space: nowrap; }
.intranet-module-identity strong { font-size: 16px; }
.intranet-module-identity span { color: #9baabc; }
.intranet-module-identity b { overflow: hidden; color: #52677d; font-size: 14px; text-overflow: ellipsis; }

.intranet-profile-link { min-width: 0; gap: 9px; padding: 4px 9px 4px 5px; border-radius: 7px; color: inherit; text-decoration: none; }
.intranet-profile-link:hover { background: #f1f6fb; }
.intranet-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #163f67; color: #fff; font-size: 12px; font-weight: 800; }
.intranet-profile-text { min-width: 0; display: grid; line-height: 1.15; }
.intranet-profile-text strong { max-width: 170px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.intranet-profile-text small { color: #6a7c8f; font-size: 11px; }
.intranet-header-module-actions { display: flex; align-items: center; gap: 7px; }
.intranet-header-module-actions:empty { display: none; }
.intranet-header-module-actions .intranet-module-action {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #ccd8e5;
  border-radius: 7px;
  background: #fff;
  color: #173b58;
  font-size: 19px;
  cursor: pointer;
}
.intranet-header-module-actions .intranet-module-action:hover { background: #eef6ff; border-color: #8db7e8; }

.intranet-global-drawer {
  position: fixed !important;
  inset: var(--intranet-header-height) auto 0 0 !important;
  z-index: 10010 !important;
  width: var(--intranet-drawer-width) !important;
  min-height: 0 !important;
  height: calc(100vh - var(--intranet-header-height)) !important;
  flex-direction: column;
  padding: 16px 12px !important;
  overflow: hidden auto;
  color: #eef7ff;
  background: linear-gradient(180deg, var(--intranet-navy) 0%, var(--intranet-navy-deep) 100%) !important;
  border-right: 1px solid rgba(255,255,255,.1);
  box-shadow: 10px 0 28px rgba(3, 21, 36, .2);
  transform: translateX(-103%);
  visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s;
}
body.intranet-drawer-open .intranet-global-drawer { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.intranet-drawer-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 15px; border-bottom: 1px solid rgba(255,255,255,.14); }
.intranet-drawer-brand img { width: 42px; height: 42px; object-fit: contain; }
.intranet-drawer-brand div { display: grid; gap: 2px; }
.intranet-drawer-brand strong { font-size: 18px; }
.intranet-drawer-brand span { color: #afc5d8; font-size: 12px; }
.intranet-global-drawer > nav { display: grid; align-content: start; gap: 5px; margin-top: 13px; }
.intranet-global-drawer > nav > a { min-height: 45px; display: flex; align-items: center; gap: 12px; padding: 7px 11px; border-radius: 7px; color: #e9f4fd; text-decoration: none; font-size: 14px; font-weight: 750; }
.intranet-global-drawer > nav > a:hover,
.intranet-global-drawer > nav > a.active { background: #155ea9; color: #fff; }
.intranet-global-drawer > nav > a img { width: 29px; height: 29px; flex: 0 0 29px; object-fit: contain; }
.intranet-global-drawer > nav > a[hidden] { display: none !important; }

.intranet-drawer-backdrop { position: fixed; inset: var(--intranet-header-height) 0 0; z-index: 10000; border: 0; background: rgba(5, 22, 37, .5); }

body.has-intranet-shell #app.shell { min-height: calc(100vh - var(--intranet-header-height)); grid-template-columns: minmax(0, 1fr) !important; }
body.has-intranet-shell #app > .intranet-source-drawer { display: grid; grid-template-rows: auto 1fr; gap: 14px; }
body.has-intranet-shell #app > .intranet-source-drawer .side-user,
body.has-intranet-shell #app > .intranet-source-drawer > .logout { display: none !important; }
/* The global drawer is full-width even when the legacy shell is collapsed. */
body.has-intranet-shell #app > .intranet-source-drawer .side-brand { font-size: 18px; padding-bottom: 12px; justify-content: flex-start; }
body.has-intranet-shell #app > .intranet-source-drawer .side-brand strong { display: block; font-size: 18px; }
body.has-intranet-shell #app > .intranet-source-drawer .side-nav button {
  min-height: 43px;
  justify-content: flex-start;
  padding: 7px 11px;
  font-size: 14px;
}
body.has-intranet-shell #app > .intranet-source-drawer .nav-parent i { display: block; font-size: 14px; }
body.has-intranet-shell #app > .intranet-source-drawer .submenu {
  display: none;
  margin: 6px 0 6px 36px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,.16);
}
body.has-intranet-shell #app > .intranet-source-drawer .nav-group.open > .submenu { display: grid; }
body.has-intranet-shell #app > .intranet-source-drawer .submenu button { font-size: 13px; }
body.has-intranet-shell #app > .intranet-source-drawer .submenu-section-title { display: block; font-size: 15px; }
body.has-intranet-shell #app > .workspace { width: 100%; min-width: 0; }
body.has-intranet-shell #app .topbar { top: var(--intranet-header-height); }
body.has-intranet-shell #app #menuBtn { display: none !important; }

body.has-intranet-shell .intranet-sidebar { display: none !important; }
body.has-intranet-shell .accounting-shell { grid-template-columns: minmax(0, 1fr) !important; }
body.has-intranet-shell .accounting-workspace { grid-column: 1 !important; }
body.has-intranet-shell > .module-nav,
body.has-intranet-shell .module-sidebar { top: var(--intranet-header-height); max-height: calc(100vh - var(--intranet-header-height)); }
body.has-intranet-shell .intranet-home-link,
body.has-intranet-shell .home-link { display: none !important; }
body.has-intranet-shell > .topbar #logoutBtn,
body.has-intranet-shell > .topbar nav > #logoutBtn { display: none !important; }
body.has-intranet-shell .intranet-legacy-topbar-hidden { display: none !important; }
body.has-intranet-shell.intranet-module-app > .shell { min-height: calc(100vh - var(--intranet-header-height)); }

body.has-intranet-shell.intranet-module-app .accounting-workspace > .topbar {
  min-height: 52px;
  padding: 7px 20px;
  background: #f7fafc;
  border-bottom: 1px solid #d8e1eb;
  color: #17365d;
}
body.has-intranet-shell.intranet-module-app .accounting-workspace > .topbar > strong { display: none; }
body.has-intranet-shell.intranet-module-app .accounting-tabs { width: 100%; }

body.has-intranet-shell #view-home.active {
  width: 100%;
  max-width: none;
}

body.has-intranet-shell #view-home .module-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 219px));
  max-width: none;
}

@media (min-width: 901px) {
  body.intranet-drawer-open { padding-left: var(--intranet-drawer-width) !important; }
}

@media (max-width: 900px) {
  body.has-intranet-shell,
  body.has-intranet-shell.intranet-drawer-open { padding-left: 0 !important; }
  body.intranet-shell-authenticated.intranet-drawer-open .intranet-drawer-backdrop { display: block; }
  .intranet-global-drawer { width: min(86vw, var(--intranet-drawer-width)) !important; }
  .intranet-profile-text { display: none; }
  .intranet-header-module-actions { margin-left: auto; }
  .intranet-profile-link { padding-right: 5px; }
  .intranet-module-identity strong,
  .intranet-module-identity span { display: none; }
  .intranet-module-identity b { max-width: 36vw; }
}

@media (max-width: 560px) {
  .intranet-global-header { padding: 0 9px; gap: 7px; }
  .intranet-header-left { gap: 6px; }
  .intranet-header-home { display: none; }
  .intranet-module-identity b { max-width: 43vw; font-size: 13px; }
  .intranet-drawer-toggle, .intranet-logout-button { width: 38px; height: 38px; flex-basis: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  body.has-intranet-shell, .intranet-global-drawer { transition: none; }
}
