:root {
  --bg: #07111f;
  --bg-soft: #0d1b2f;
  --panel: rgba(10, 22, 38, 0.82);
  --panel-solid: #0f1b2d;
  --text: #e8f3ff;
  --muted: #8fa8c7;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #56f0c8;
  --accent-2: #7c5cff;
  --danger: #ff6b8a;
  --white: #ffffff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden; /* 🚨 prevents whole page scrolling */
}

.app-shell {
  display: flex;
  height: 100vh; /* full viewport height */
}

/* Sidebar: fixed width, full height */
.sidebar {
  width: 240px; /* adjust as needed */
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden; /* 👈 prevents sidebar scroll */
  border-right: 1px solid #dee2e6;
  background: #fff;
}

/* Main content: ONLY scrollable area */
.main-content {
  flex: 1;
  overflow-y: auto;
  height: 100vh;
  padding: 1.5rem;
}

body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.1fr) minmax(380px, 0.9fr);
  background:
    radial-gradient(circle at top right, rgba(86, 240, 200, 0.2), transparent 28%),
    radial-gradient(circle at bottom left, rgba(124, 92, 255, 0.22), transparent 30%),
    var(--bg);
}

.auth-visual {
  position: relative;
  min-height: 100vh;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(7, 17, 31, 0.15), rgba(7, 17, 31, 0.72)),
    url("../images/aurora-login.jpg");
  background-size: cover;
  background-position: center;
}

.auth-visual-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 20%, rgba(86, 240, 200, 0.25), transparent 28%),
    linear-gradient(180deg, rgba(7, 17, 31, 0.1), rgba(7, 17, 31, 0.78));
  pointer-events: none;
}

.auth-brand,
.auth-visual-copy {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #04110f;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #9cffeb);
  box-shadow: 0 12px 40px rgba(86, 240, 200, 0.28);
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.1rem;
}

.auth-brand p {
  margin: 3px 0 0;
  color: rgba(232, 243, 255, 0.72);
}

.auth-visual-copy {
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 800;
}

.auth-visual-copy h2 {
  margin: 0;
  font-size: clamp(2.25rem, 4vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-card {
  width: min(100%, 440px);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-header h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.auth-header p {
  color: var(--muted);
}

.auth-form {
  margin-top: 28px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #c5d8ef;
  font-size: 0.9rem;
  font-weight: 700;
}

/*.form-control {*/
/*  width: 100%;*/
/*  border: 1px solid lightgray;*/
/*  border-radius: 14px;*/
/*  padding: 13px 14px;*/
/*  background: rgba(255, 255, 255, 0.075);*/
/*  color: var(--text);*/
/*  outline: none;*/
/*  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;*/
/*}*/

/*.form-control:focus {*/
/*  border-color: rgba(86, 240, 200, 0.72);*/
/*  box-shadow: 0 0 0 4px rgba(86, 240, 200, 0.12);*/
/*  background: rgba(255, 255, 255, 0.095);*/
/*}*/

.errorlist {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 0.85rem;
}

.form-errors {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #ffdce5;
  background: rgba(255, 107, 138, 0.12);
  border: 1px solid rgba(255, 107, 138, 0.24);
}

.btn-primary-borealis {
  border: 0;
  cursor: pointer;
  font-weight: 800;
  border-radius: 14px;
  padding: 13px 18px;
}

.btn-primary-borealis {
  width: 100%;
  color: #03120f;
  background: linear-gradient(135deg, var(--accent), #a6ffe9);
  box-shadow: 0 16px 34px rgba(86, 240, 200, 0.22);
}

.btn-primary-btn-primary-borealis:hover {
  filter: brightness(1.04);
}

.btn-link {
  display: inline-block;
  text-align: center;
}

.auth-footer {
  margin-top: 24px;
  color: var(--muted);
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background:
    radial-gradient(circle at top left, rgba(86, 240, 200, 0.12), transparent 28%),
    var(--bg);
}

.sidebar-borealis {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 12, 22, 0.72);
  min-width: 250px;
}

.sidebar-borealis-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.sidebar-borealis-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.sidebar-borealis-nav {
  display: grid;
  gap: 8px;
}

.sidebar-borealis-nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: #c9d9ee;
}

.sidebar-borealis-nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.main-content {
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.empty-state {
  margin-top: 48px;
  max-width: 720px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    var(--panel-solid);
}

.empty-state h2 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}

.empty-state p {
  color: var(--muted);
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 340px;
  }

  .auth-panel {
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar-borealis {
    display: none;
  }
}

.sidebar-borealis {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 12, 22, 0.72);
}

.tenant-switcher,
.sidebar-borealis-user {
  position: relative;
}

.tenant-button,
.user-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.tenant-menu,
.user-menu {
  display: none;
  position: absolute;
  left: calc(100% - 1px);
  top: 0;
  min-width: 240px;
  z-index: 50;

  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  background: #0d1b2f;
  box-shadow: var(--shadow);
}

.tenant-switcher:hover .tenant-menu,
.sidebar-borealis-user:hover .user-menu {
  display: grid;
  gap: 4px;
}
.tenant-switcher::after,
.sidebar-borealis-user::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: 16px;
  height: 100%;
}
.tenant-switcher:hover .tenant-menu,
.tenant-switcher:focus-within .tenant-menu,
.sidebar-borealis-user:hover .user-menu,
.sidebar-borealis-user:focus-within .user-menu {
  display: grid;
  gap: 4px;
}

.tenant-menu a,
.user-menu a,
.user-menu button {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: #c9d9ee;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.tenant-menu a:hover,
.tenant-menu a.active,
.user-menu a:hover,
.user-menu button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-borealis-nav {
  margin-top: 24px;
  display: grid;
  gap: 8px;
}

.sidebar-borealis-user {
  margin-top: auto;
}

.user-button {
  gap: 10px;
  justify-content: flex-start;
}

.user-button > span:last-child {
  margin-left: auto;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #03120f;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #a6ffe9);
}

.user-button strong,
.user-button span {
  display: block;
}

.user-button span {
  color: var(--muted);
  font-size: 0.8rem;
}

.user-menu {
  top: auto;
  bottom: 0;
}

.muted-menu-item {
  padding: 10px 12px;
  color: var(--muted);
}

.nav-group.menu-closing .nav-flyout,
.tenant-switcher.menu-closing .tenant-menu,
.sidebar-borealis-user.menu-closing .user-menu {
  display: none !important;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.empty-state {
  max-width: 720px;
  margin: 0 auto;
}

.asset-form-card {
  max-width: 720px;
}

.asset-form-card .card-body {
  color: #212529;
}

.asset-form-card h2,
.asset-form-card label {
  color: #212529;
}
.asset-form-card {
  max-width: 900px;
}

.asset-form-card .errorlist {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  color: #dc3545;
  font-size: 0.875rem;
}

.asset-form-card .form-check input {
  margin-right: 0.35rem;
}

.device-render-box {
  min-height: 180px;
  overflow-x: auto;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: .75rem;
}

.device-render-box .device,
.device-render-box .device-back {
  position: relative;
  background: #2f343a;
  border-radius: .35rem;
  margin: 0 auto;
}

.config-view {
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 1rem;
  background: #111827;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre;
}

.asset-scroll-list {
  max-height: 260px;
  overflow-y: auto;
  padding-right: .25rem;
}

.asset-config-card {
    min-height: calc(100vh - 260px);
}

.asset-scroll-list {
    overflow-y: auto;
}

.device-panel-wrapper {
    width: 100%;
    min-height: 160px;
    height: 160px;
    display: flex;
    overflow: hidden;
}

#device-panel {
    position: relative;
}

#interfaceConfigModal .form-control::placeholder {
    color: #adb5bd !important;
}

.sidebar-borealis .workspace-badge {
    font-size: 0.75rem !important;
    line-height: 1;
    display: inline-block;
}

.tenant-menu-group {
    position: relative;
}

.tenant-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tenant-menu-group {
    position: relative;
}

.tenant-menu-link {
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tenant-workspace-flyout {
    display: none;
    position: absolute;
    top: 0;
    left: calc(100% - 2px);

    min-width: 220px;
    z-index: 50;

    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;

    background: #0d1b2f;
    box-shadow: var(--shadow);

    gap: 4px;
}

.tenant-menu-group:hover > .tenant-workspace-flyout,
.tenant-menu-group:focus-within > .tenant-workspace-flyout {
    display: grid;
}

.tenant-menu-group::after {
    content: "";
    position: absolute;
    top: 0;
    left: 100%;
    width: 16px;
    height: 100%;
}

.tenant-workspace-flyout a,
.tenant-workspace-flyout .muted-menu-item {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    color: #c9d9ee;
    background: transparent;
    text-align: left;
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.tenant-workspace-flyout a:hover,
.tenant-workspace-flyout a.active {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.tenant-workspace-flyout .muted-menu-item {
    color: var(--muted);
}

.filter-toggle-icon {
    transition: transform 0.2s ease;
}

.card-header[aria-expanded="true"] .filter-toggle-icon {
    transform: rotate(180deg);
}

.asset-stack-toggle {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0 0.4rem 0 0;
    line-height: 1;
    color: #6c757d;
    vertical-align: middle;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
}

.asset-stack-toggle:hover,
.asset-stack-toggle:focus,
.asset-stack-toggle:active {
    color: #495057;
    text-decoration: none;
    box-shadow: none;
    outline: none;
}

.asset-stack-chevron {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    position: relative;
    vertical-align: -0.1em;
}

.asset-stack-chevron::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0.42rem;
    height: 0.42rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translate(-65%, -60%) rotate(-45deg);
    transition: transform 0.2s ease;
}

.asset-stack-toggle[aria-expanded="true"] .asset-stack-chevron::before {
    transform: translate(-60%, -35%) rotate(45deg);
}

.asset-stack-row > td {
    background-color: #f8fafc;
    border-top-color: #e2e8f0;
}

.asset-stack-member-row > td {
    background-color: #edf2f8;
    border-top-color: #dbe4ee;
}

.asset-stack-member-row .asset-stack-member-name {
    padding-left: 2.25rem !important;
    box-shadow: inset 3px 0 0 rgba(13, 110, 253, 0.35);
}

.table-hover > tbody > tr.asset-stack-row:hover > td,
.table-hover > tbody > tr.asset-stack-member-row:hover > td {
    background-color: #e3ebf5;
}


.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group {
  position: relative;
}

/* Flyout container */
.nav-flyout {
  display: none;
  position: absolute;
  top: 0;
  left: calc(100% - 2px);

  min-width: 220px;
  z-index: 50;

  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;

  background: #0d1b2f;
  box-shadow: var(--shadow);

  display: none;
  gap: 4px;
}

/* Show on hover */
.nav-group:hover .nav-flyout,
.nav-group:focus-within .nav-flyout {
  display: grid;
}

/* Bridge gap (CRITICAL) */
.nav-group::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: 16px;
  height: 100%;
}

/* Child links */
.nav-sublink {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-sublink:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* Divider */
.nav-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--line);
}

/* Optional header */
.nav-subheader {
  padding: 8px 12px 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 800;
}
.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-caret {
  opacity: 0.6;
  font-size: 0.8rem;
}
.nav-group:hover > .nav-link {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.nav-sublink {
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-sublink:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.nav-divider {
  height: 1px;
  margin: 6px 8px;
  background: var(--line);
}

.nav-subheader {
  padding: 8px 12px 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 800;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.nav-link,
.nav-sublink {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.nav-link .nav-caret {
    margin-left: auto;
}

.nav-icon {
    width: 1.25rem;
    min-width: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    font-size: 1rem;
    line-height: 1;
}

.nav-subicon {
    width: 1rem;
    min-width: 1rem;
    font-size: 0.9rem;
}

.nav-icon-placeholder {
    opacity: 0;
}

.nav-main {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}