:root {
  --portal-bg: #0b1119;
  --portal-sidebar: rgba(16, 25, 36, .97);
  --portal-workspace: rgba(11, 17, 25, .88);
  --portal-surface: rgba(25, 36, 50, .82);
  --portal-surface-strong: #1b2735;
  --portal-surface-soft: rgba(18, 27, 39, .82);
  --portal-line: rgba(166, 181, 201, .2);
  --portal-line-strong: rgba(166, 181, 201, .34);
  --portal-text: #f4f7fb;
  --portal-muted: #aeb8c8;
  --portal-teal: #2dd4a8;
  --portal-blue: #6b8cff;
  --portal-green: #35c76f;
  --portal-gold: #f4c95d;
  --portal-coral: #ff7468;
}

.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

body.portal-body {
  min-width: 320px;
  min-height: 100svh;
  padding: 0;
  background-color: var(--portal-bg);
  color: var(--portal-text);
}

body.portal-body::before {
  background:
    linear-gradient(90deg, rgba(8, 14, 21, .45), rgba(8, 14, 21, .78)),
    rgba(8, 14, 21, .54);
}

.portal-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  width: min(1540px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  border-inline: 1px solid var(--portal-line);
  background: var(--portal-workspace);
  box-shadow: 0 0 80px rgba(0, 0, 0, .35);
}

.portal-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  min-height: 680px;
  padding: 28px 20px 20px;
  overflow: auto;
  border-right: 1px solid var(--portal-line);
  background: var(--portal-sidebar);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  color: var(--portal-text);
  text-decoration: none;
}

.portal-brand img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .32);
}

.portal-brand span,
.portal-brand strong,
.portal-brand small,
.launcher-connection span,
.launcher-connection strong,
.launcher-connection small,
.portal-profile span,
.portal-profile strong,
.portal-profile small {
  display: block;
  min-width: 0;
}

.portal-brand strong {
  font-size: 25px;
  line-height: 1.05;
}

.portal-brand small {
  margin-top: 5px;
  color: var(--portal-muted);
  font-size: 12px;
  font-weight: 650;
}

.portal-navigation {
  margin-top: 28px;
}

.portal-nav-group + .portal-nav-group {
  margin-top: 24px;
}

.portal-nav-group > p {
  margin: 0 0 8px;
  padding: 0 12px;
  color: #7f8ca0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--portal-muted);
  font-size: 14px;
  font-weight: 680;
  text-decoration: none;
}

.portal-nav-link + .portal-nav-link {
  margin-top: 3px;
}

.portal-nav-link:hover {
  border-color: rgba(166, 181, 201, .16);
  background: rgba(166, 181, 201, .07);
  color: var(--portal-text);
}

.portal-nav-link.active {
  border-color: rgba(107, 140, 255, .55);
  background: rgba(107, 140, 255, .16);
  color: #fff;
}

.portal-nav-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: var(--portal-blue);
}

.portal-nav-link.active .ui-icon {
  color: var(--portal-blue);
}

.portal-sidebar-footer {
  margin-top: auto;
  padding-top: 30px;
}

.launcher-connection,
.portal-profile,
.portal-signout {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 50px;
  padding: 9px 11px;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  background: rgba(31, 43, 58, .65);
  color: var(--portal-text);
  text-decoration: none;
}

.launcher-connection:hover,
.portal-profile:hover,
.portal-signout:hover {
  border-color: var(--portal-line-strong);
  background: rgba(39, 53, 71, .8);
}

.launcher-connection strong,
.portal-profile strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launcher-connection small,
.portal-profile small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--portal-muted);
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--portal-gold);
  box-shadow: 0 0 0 4px rgba(244, 201, 93, .12);
}

.connection-dot.online {
  background: var(--portal-green);
  box-shadow: 0 0 0 4px rgba(53, 199, 111, .12);
}

.portal-profile {
  margin-top: 8px;
}

.portal-signout {
  min-height: 42px;
  margin-top: 8px;
  color: #ffd2ce;
  font-size: 13px;
  font-weight: 700;
}

.portal-workspace {
  min-width: 0;
}

.portal-mobilebar {
  display: none;
}

.portal-content {
  width: min(1180px, calc(100% - 64px));
  min-height: 100svh;
  margin: 0 auto;
  padding: 52px 0 72px;
}

.portal-content > .eyebrow,
.portal-content .toolbar .eyebrow {
  color: var(--portal-blue);
}

.portal-content h1 {
  max-width: 900px;
  font-size: 42px;
}

.portal-content > .intro {
  max-width: 760px;
  margin-bottom: 30px;
  font-size: 16px;
}

.portal-content .panel {
  border-color: var(--portal-line);
  background: var(--portal-surface-soft);
  box-shadow: none;
}

.portal-content .facts {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 7px;
  background: var(--portal-line);
}

.portal-content .fact {
  min-height: 82px;
  background: var(--portal-surface-soft);
}

.portal-content .section-list {
  border-top-color: var(--portal-line);
}

.portal-content .section-row {
  border-bottom-color: var(--portal-line);
}

.portal-content .section-row:hover {
  background: rgba(45, 212, 168, .035);
}

.control-hero {
  position: relative;
  min-height: 210px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(12, 19, 28, .95) 0%, rgba(12, 19, 28, .68) 66%, rgba(12, 19, 28, .35) 100%),
    url('/_auth/hero.jpg') center 42% / cover no-repeat;
}

.control-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--portal-teal), var(--portal-blue), transparent 82%);
}

.control-hero > * {
  position: relative;
  z-index: 1;
}

.control-hero h1 {
  max-width: 720px;
}

.control-hero .intro {
  max-width: 690px;
  margin-bottom: 0;
}

.control-hero.compact-hero {
  min-height: 190px;
}

.control-hero.launcher-hero {
  background:
    linear-gradient(90deg, rgba(12, 19, 28, .96) 0%, rgba(12, 19, 28, .7) 68%, rgba(12, 19, 28, .4) 100%),
    url('/_auth/hero.jpg') center 48% / cover no-repeat;
}

.control-hero.team-hero {
  background:
    linear-gradient(90deg, rgba(12, 19, 28, .97) 0%, rgba(12, 19, 28, .72) 70%, rgba(12, 19, 28, .4) 100%),
    url('/_auth/hero.jpg') center 60% / cover no-repeat;
}

.control-hero.library-hero,
.control-hero.accounts-hero,
.control-hero.status-hero {
  background:
    linear-gradient(90deg, rgba(12, 19, 28, .97) 0%, rgba(12, 19, 28, .7) 68%, rgba(12, 19, 28, .42) 100%),
    url('/_auth/hero.jpg') center 54% / cover no-repeat;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 14px;
}

.section-heading-row h2,
.section-heading-row p {
  margin: 0;
}

.section-heading-row p {
  margin-top: 4px;
  color: var(--portal-muted);
  font-size: 13px;
}

.library-grid {
  align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.library-world {
  min-height: 100%;
}

.library-world .toolbar {
  min-height: 58px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr);
  gap: 18px;
  margin-top: 18px;
}

.overview-section {
  padding: 22px;
  border: 1px solid var(--portal-line);
  background: var(--portal-surface-soft);
}

.overview-section:first-child {
  border-radius: 8px 0 0 8px;
}

.overview-section:last-child {
  border-radius: 0 8px 8px 0;
}

.overview-section h2 {
  margin-bottom: 6px;
}

.overview-section > p {
  margin: 0 0 18px;
  color: var(--portal-muted);
}

.overview-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 66px;
  padding: 12px 14px;
  border-top: 1px solid var(--portal-line);
  color: var(--portal-text);
  text-decoration: none;
}

.overview-action:last-child {
  border-bottom: 1px solid var(--portal-line);
}

.overview-action:hover {
  background: rgba(107, 140, 255, .07);
}

.overview-action .ui-icon {
  color: var(--portal-blue);
}

.overview-action strong,
.overview-action small {
  display: block;
}

.overview-action small {
  margin-top: 3px;
  color: var(--portal-muted);
}

.overview-action > em {
  color: var(--portal-teal);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.state-list {
  border-top: 1px solid var(--portal-line);
}

.state-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 58px;
  border-bottom: 1px solid var(--portal-line);
}

.state-row .dot {
  width: 8px;
  height: 8px;
}

.state-row strong,
.state-row small {
  display: block;
}

.state-row small {
  color: var(--portal-muted);
}

.state-row > span:last-child {
  color: var(--portal-muted);
  font-size: 12px;
}

.workspace-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.workspace-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background: var(--portal-surface-soft);
  color: var(--portal-text);
  text-decoration: none;
}

.workspace-link:hover {
  border-color: rgba(45, 212, 168, .48);
  background: rgba(24, 42, 49, .82);
}

.workspace-link .ui-icon {
  color: var(--portal-teal);
}

.workspace-link h2 {
  margin: 0 0 5px;
  font-size: 17px;
}

.workspace-link p {
  margin: 0;
  color: var(--portal-muted);
  font-size: 13px;
}

.launcher-platforms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.platform-download {
  min-height: 168px;
  padding: 20px;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background: var(--portal-surface-soft);
}

.platform-download h2 {
  margin-bottom: 7px;
}

.platform-download p {
  min-height: 46px;
  color: var(--portal-muted);
}

.launcher-connection-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--portal-line);
  border-radius: 8px;
  background: var(--portal-surface-soft);
}

.launcher-connection-panel h2,
.launcher-connection-panel p {
  margin: 0;
}

.launcher-connection-panel p {
  margin-top: 4px;
  color: var(--portal-muted);
}

.team-context-grid {
  margin-top: 18px;
}

.canonical-note {
  margin: 24px 0 0;
  padding: 15px 17px;
  border-left: 3px solid var(--portal-blue);
  background: rgba(107, 140, 255, .07);
  color: var(--portal-muted);
}

@media (max-width: 1040px) {
  .portal-shell {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .portal-sidebar {
    padding-inline: 14px;
  }

  .portal-brand span {
    display: none;
  }

  .portal-content {
    width: min(100% - 40px, 960px);
  }

  .portal-content h1 {
    font-size: 32px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .overview-section:first-child,
  .overview-section:last-child {
    border-radius: 8px;
  }
}

@media (max-width: 760px) {
  body.portal-body {
    padding: 0;
  }

  .portal-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 0;
  }

  .portal-workspace {
    display: contents;
  }

  .portal-mobilebar {
    order: 1;
  }

  .portal-sidebar {
    order: 2;
    position: static;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 14px 16px;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--portal-line);
  }

  .portal-brand,
  .portal-sidebar-footer {
    display: none;
  }

  .portal-navigation {
    display: flex;
    gap: 8px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .portal-navigation::-webkit-scrollbar {
    display: none;
  }

  .portal-nav-group {
    display: contents;
  }

  .portal-nav-group + .portal-nav-group {
    margin: 0;
  }

  .portal-nav-group > p {
    display: none;
  }

  .portal-nav-link {
    flex: 0 0 auto;
    min-height: 42px;
    padding-inline: 11px;
  }

  .portal-nav-link.active::before {
    inset: auto 8px -1px;
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
  }

  .portal-mobilebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 18px;
    border-bottom: 1px solid var(--portal-line);
    background: var(--portal-sidebar);
    font-size: 13px;
  }

  .portal-mobilebar a {
    color: var(--portal-text);
    text-decoration: none;
  }

  .portal-mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
  }

  .portal-mobile-brand img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }

  .portal-content {
    order: 3;
    width: 100%;
    min-height: auto;
    padding: 30px 18px 52px;
  }

  .control-hero {
    min-height: 230px;
    padding: 26px 20px;
  }

  .workspace-list,
  .launcher-platforms {
    grid-template-columns: 1fr;
  }

  .launcher-connection-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .launcher-connection-panel form {
    grid-column: 1 / -1;
  }

  .section-heading-row {
    align-items: stretch;
    flex-direction: column;
  }

  .launcher-connection-panel button {
    width: 100%;
  }

  .overview-action {
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding-block: 14px;
  }

  .overview-action > .ui-icon {
    margin-top: 2px;
  }

  .overview-action > em {
    grid-column: 2;
    margin-top: 5px;
  }
}
