:root {
  --app-sidebar: #07111f;
  --app-sidebar-soft: #102033;
  --app-bg: #eef3f8;
  --app-bg-deep: #e6edf5;
  --app-surface: #ffffff;
  --app-border: #d7e1ec;
  --app-text: #111827;
  --app-muted: #5d6b7c;
  --app-primary: #1769aa;
  --app-primary-soft: #e7f2fb;
}

body {
  background:
    radial-gradient(circle at 62% -12%, rgba(23, 105, 170, .13), transparent 34%),
    linear-gradient(135deg, var(--app-bg), var(--app-bg-deep));
}

.appShell {
  grid-template-columns: 288px minmax(0, 1fr);
  background: transparent;
}

.appSidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 34%),
    linear-gradient(165deg, #081526 0%, #07111f 54%, #050b14 100%);
  border-right: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 18px 0 48px rgba(7, 17, 31, .22);
}

.appSidebarHeader {
  flex: 0 0 auto;
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.appSidebarTitle {
  margin: 0;
  color: #f7fbff;
  font-size: 18px;
  line-height: 1.12;
  font-weight: 780;
}

.appSidebarSubtitle {
  display: block;
  margin-top: 5px;
  color: rgba(247, 251, 255, .64);
  font-size: 12px;
  font-weight: 650;
}

.appRegisterNav {
  flex: 1 1 auto;
  padding: 16px 12px 22px;
  overflow: auto;
}

.appRegisterNav .nav-title {
  padding: 0 10px 12px;
  color: rgba(247, 251, 255, .42);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.appRegisterNav .nav-button {
  position: relative;
  min-height: 34px;
  margin: 0 0 5px;
  padding: 8px 26px 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(247, 251, 255, .69);
  text-align: left;
  white-space: normal;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.25;
}

.appRegisterNav .nav-button::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
}

.appRegisterNav .nav-button.active {
  background: linear-gradient(90deg, rgba(29, 111, 184, .34), rgba(29, 111, 184, .13));
  color: #fff;
  box-shadow: inset 4px 0 0 #61b4f4, inset 0 0 0 1px rgba(158, 204, 244, .13);
}

.appRegisterNav .nav-button.active::after {
  background: #61b4f4;
  box-shadow: 0 0 0 4px rgba(97, 180, 244, .16);
}

.appRoleAnchor {
  margin: 0 14px 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  color: rgba(247, 251, 255, .72);
}

.appRoleAnchor span,
.appRoleAnchor small {
  display: block;
  color: rgba(247, 251, 255, .52);
  font-size: 11px;
  font-weight: 750;
}

.appRoleAnchor strong {
  display: block;
  margin: 4px 0;
  color: #fff;
  font-size: 13px;
}

.appMain {
  min-width: 0;
}

.appTopBar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  background: rgba(248, 251, 255, .9);
  border-bottom: 1px solid rgba(183, 198, 216, .72);
  backdrop-filter: blur(14px);
}

.appTopBarChips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.app-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: #fff;
  color: var(--app-muted);
  font-size: 12px;
}

.app-context-chip strong {
  color: var(--app-text);
  font-weight: 820;
}

.app-context-chip.is-demo strong {
  color: #1769aa;
}

.appLogoutButton {
  min-height: 34px;
  border-radius: 8px;
  background: #fff;
  color: var(--app-primary);
  border: 1px solid var(--app-border);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.appScopeRow {
  position: sticky;
  top: 62px;
  z-index: 29;
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 8px 28px;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid rgba(215, 225, 236, .88);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
  backdrop-filter: blur(12px);
}

.appScopeRow .module-scope-shell {
  width: 100%;
  min-width: 0;
}

.appScopeRow .module-scope-bar {
  max-width: none;
}

.appScopeRow .module-scope-field label {
  min-height: 32px;
  color: var(--app-muted);
}

.appScopeRow .module-scope-field select,
.appScopeRow .module-scope-load {
  min-height: 32px;
  border-radius: 8px;
}

.appContent {
  padding: 24px clamp(18px, 2.6vw, 38px);
  max-width: 1500px;
  margin: 0 auto;
}

.mode-card,
.login-card {
  border-radius: 8px;
  border-color: var(--app-border);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

@media (max-width: 980px) {
  .appShell {
    grid-template-columns: 1fr;
  }
  .appSidebar {
    position: relative;
    height: auto;
  }
  .appRegisterNav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 12px 12px;
  }
  .appRegisterNav .nav-title {
    display: none;
  }
  .appRegisterNav .nav-button {
    flex: 0 0 190px;
    margin: 0;
  }
  .appRoleAnchor {
    display: none;
  }
  .appTopBar {
    align-items: flex-start;
    padding: 10px 18px;
  }
  .appScopeRow {
    top: 58px;
    padding: 9px 18px;
  }
}

@media (max-width: 720px) {
  .appScopeRow {
    position: relative;
    top: auto;
  }
  .appContent {
    padding: 18px;
  }
}
