:root {
  --sidebar-width: 304px;
  --header-height: 64px;
  --navy: #0b2d4b;
  --navy-2: #123d62;
  --blue: #246bfd;
  --cyan: #55d6cf;
  --line: #d9e1e8;
  --text: #17344f;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--text); background: #fbfaf7; font-family: "Microsoft YaHei UI", "Yu Gothic UI", "Segoe UI", Arial, sans-serif; }
button, a { font: inherit; }
button { letter-spacing: 0; }

.portal-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  padding: 22px 18px 34px;
  overflow-y: auto;
  color: #dce8f2;
  background: var(--navy);
  scrollbar-width: thin;
  scrollbar-color: #496783 transparent;
}

.sidebar-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 10px;
  align-items: start;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  color: white;
  text-decoration: none;
}
.portal-brand > span:last-child { min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--blue);
  box-shadow: 0 8px 24px rgba(36, 107, 253, .34);
  font: 800 25px/1 Arial, sans-serif;
}
.portal-brand strong { display: block; font: 700 18px/1.15 Arial, sans-serif; }
.portal-brand small { display: block; margin-top: 5px; color: #9fb7cb; font-size: 11px; text-transform: uppercase; }
.system-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  margin-top: 7px;
  padding: 3px;
  border: 1px solid rgba(157, 187, 210, .24);
  border-radius: 5px;
  background: rgba(5, 25, 43, .36);
}
.system-tab {
  display: grid;
  place-items: center;
  min-width: 0;
  height: 28px;
  border-radius: 3px;
  color: #8ca8bd;
  font: 700 10px/1 Arial, sans-serif;
  text-decoration: none;
}
.system-tab:hover { color: white; background: rgba(255, 255, 255, .08); }
.system-tab.selected { color: var(--navy); background: var(--cyan); }

.portal-nav { margin-top: 26px; }
.system-menu[hidden] { display: none; }
.product-label {
  margin: 24px 10px 8px;
  color: #6f8ba3;
  font: 700 10px/1 Arial, sans-serif;
}
.portal-home,
.portal-direct,
.module-link,
.module-items a {
  color: inherit;
  text-decoration: none;
}
.portal-home,
.portal-direct,
.module-link {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  padding: 7px 40px 7px 10px;
  border-radius: 6px;
}
.portal-home { margin-bottom: 10px; padding-right: 10px; }
.portal-home span,
.portal-direct span,
.module-link span { color: #77e0d9; font: 700 10px/1 Arial, sans-serif; }
.portal-home b,
.portal-direct b,
.module-link b { overflow-wrap: anywhere; font-size: 14px; font-weight: 700; line-height: 1.35; }
.portal-home:hover,
.portal-direct:hover,
.module-link:hover,
.portal-route.active { color: white; background: rgba(255, 255, 255, .09); }
.portal-home.active,
.portal-direct.active,
.module-link.active { box-shadow: inset 3px 0 var(--cyan); }
.system-tab.selected,
.system-tab.selected.active { color: var(--navy); background: var(--cyan); box-shadow: none; }

.nav-module { margin-top: 3px; }
.module-head { position: relative; }
.module-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: #a8bed0;
  background: transparent;
  cursor: pointer;
}
.module-toggle::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .18s ease, top .18s ease;
}
.nav-module.collapsed .module-toggle::before { top: 10px; transform: rotate(-45deg); }
.module-toggle:hover { color: white; background: rgba(255, 255, 255, .1); }

.module-items {
  display: grid;
  gap: 2px;
  max-height: 1100px;
  padding: 3px 0 7px 18px;
  overflow: hidden;
  opacity: 1;
  transition: max-height .24s ease, opacity .18s ease, padding .24s ease;
}
.nav-module.collapsed .module-items { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }
.module-items a {
  display: block;
  min-height: 34px;
  padding: 8px 10px 7px 24px;
  border-radius: 5px;
  color: #c7d7e4;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.module-items a::before { content: ""; position: absolute; }
.module-items a:hover,
.module-items a.active { color: white; background: rgba(255, 255, 255, .09); }
.module-items a.active { box-shadow: inset 2px 0 var(--cyan); }
.module-items a.indent { padding-left: 38px; color: #c7d7e4; font-size: 12px; }
.subgroup {
  display: block;
  margin: 8px 10px 2px 24px;
  color: #6f8ba3;
  font: 700 9px/1.4 Arial, sans-serif;
  text-transform: uppercase;
}

.portal-header {
  position: fixed;
  inset: 0 0 auto var(--sidebar-width);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-height);
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .98);
}
.menu-button { display: none; }
.current-location { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.current-location small { flex: 0 0 auto; color: #728598; font-size: 11px; }
.current-location strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.language-switcher {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  margin-left: auto;
  padding: 4px;
  border-radius: 6px;
  background: var(--navy);
}
.language-switcher button {
  min-width: 38px;
  height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  color: #dce8f2;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}
.language-switcher button.active { color: var(--navy); background: white; }

.portal-content { position: fixed; inset: var(--header-height) 0 0 var(--sidebar-width); background: #fbfaf7; }
.frame-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #728598;
  background: rgba(244, 246, 248, .88);
  font-size: 13px;
}
.portal-content.loading .frame-loading { display: grid; }
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #cbd6df;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: loading-spin .7s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
.manual-host { display: block; width: 100%; height: 100%; overflow: auto; background: #fbfaf7; outline: 0; }
.portal-scrim { display: none; }

@media (max-width: 820px) {
  :root { --header-height: 58px; }
  .portal-sidebar { width: min(86vw, 304px); transform: translateX(-102%); transition: transform .22s ease; }
  .portal-sidebar.open { transform: translateX(0); }
  .portal-header { left: 0; padding: 0 12px; }
  .menu-button {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--navy);
    background: white;
    cursor: pointer;
    font-size: 19px;
  }
  .current-location { display: block; flex: 1 1 auto; }
  .current-location small { display: block; margin-bottom: 2px; font-size: 9px; }
  .current-location strong { display: block; font-size: 13px; }
  .language-switcher { gap: 0; padding: 3px; }
  .language-switcher button { min-width: 30px; height: 30px; padding: 0 6px; font-size: 12px; }
  .portal-content { left: 0; }
  .portal-scrim { position: fixed; inset: 0; z-index: 25; display: block; visibility: hidden; background: rgba(4, 19, 33, .5); opacity: 0; transition: opacity .22s ease, visibility .22s ease; }
  .portal-scrim.show { visibility: visible; opacity: 1; }
}
