@font-face {
  font-family: "Open Sans";
  src: url("../fonts/opensans/OpenSans-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/opensans/OpenSans-Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/opensans/OpenSans-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/opensans/OpenSans-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("../fonts/opensans/OpenSans-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

html {
  font-size: 14px;
  --bs-font-sans-serif: "Open Sans", "Segoe UI", Arial, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100vh;
  font-family: var(--bs-body-font-family);
  background:
    radial-gradient(circle at top left, rgba(21, 101, 192, 0.14), transparent 32%),
    linear-gradient(180deg, #f5f8fc 0%, #eef3f8 100%);
  color: #16324a;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 1030;
}

.portal-nav {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.portal-badge {
  border: 1px solid #b7c8da;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  color: #24537e;
}

.portal-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-user {
  font-weight: 600;
  color: #39546c;
}

.profile-menu-trigger,
.notification-trigger {
  position: relative;
}

.icon-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
}

.icon-menu-trigger.dropdown-toggle::after {
  display: none;
}

.menu-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.profile-menu-name {
  font-weight: 600;
  color: #35556f;
}

.profile-menu-section {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d8296;
}

.notification-count {
  position: absolute;
  top: -0.25rem;
  right: -0.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #dceeff;
  color: #1f5d95;
  font-size: 0.8rem;
  font-weight: 700;
}

.notification-menu {
  width: min(24rem, calc(100vw - 2rem));
  padding: 0;
  border-radius: var(--portal-radius-panel);
  border-color: #d4deea;
  overflow: hidden;
}

.notification-menu-header,
.notification-empty-state,
.notification-item {
  padding: 1rem;
}

.notification-menu-header {
  background: #f5f8fc;
  border-bottom: 1px solid #e3eaf2;
}

.notification-empty-state {
  color: #5f7487;
}

.notification-item {
  display: grid;
  gap: 0.85rem;
  border-top: 1px solid #e3eaf2;
}

.notification-item:first-of-type {
  border-top: 0;
}

.notification-title {
  font-weight: 700;
}

.notification-meta {
  margin: 0.2rem 0 0;
  color: #5f7487;
}

.notification-actions {
  display: flex;
  gap: 0.5rem;
}

.profile-menu-submit {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
}

.portal-modal {
  border: 1px solid #d4deea;
  border-radius: var(--portal-radius-panel);
  box-shadow: 0 18px 40px rgba(18, 43, 66, 0.12);
}

.portal-modal .modal-header,
.portal-modal .modal-footer {
  border-color: #e3eaf2;
}

.hero-panel {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.6fr 1fr;
  align-items: stretch;
  margin-top: 2rem;
}

.hero-copy,
.status-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d4deea;
  border-radius: var(--portal-radius-panel);
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(18, 43, 66, 0.08);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2c6fb7;
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.98;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.1rem;
  max-width: 42rem;
  color: #4d6378;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.context-note {
  margin-top: 1rem;
  color: #5f7487;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding-top: 2rem;
}

.auth-card {
  width: min(100%, 32rem);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d4deea;
  border-radius: var(--portal-radius-panel);
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(18, 43, 66, 0.08);
}

.auth-card h1 {
  margin-bottom: 0.5rem;
}

.auth-card .lead {
  margin-bottom: 1.5rem;
}

.demo-credentials {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f4f8fb;
  border: 1px solid #dbe6f0;
  border-radius: 12px;
}

.demo-credentials code {
  color: #17324d;
}

.status-card h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.status-card dl {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.status-card dl div {
  border-top: 1px solid #e3eaf2;
  padding-top: 1rem;
}

.status-card dl div:first-child {
  border-top: 0;
  padding-top: 0;
}

.status-card dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6d8296;
}

.status-card dd {
  margin: 0.35rem 0 0;
  font-weight: 600;
}

.footer {
  background: transparent;
}

@media (max-width: 900px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }
}html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.org-switcher {
  min-width: 11rem;
}

.org-switcher-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.workspace-shell {
  display: grid;
  gap: 1.5rem;
}

.workspace-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 0.9fr);
  align-items: start;
}

.org-dashboard-shell {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
  align-items: start;
}

.org-dashboard-shell.is-collapsed {
  grid-template-columns: 4.75rem minmax(0, 1fr);
}

.org-dashboard-sidebar {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 0.9rem 0.5rem;
  overflow: hidden;
}

.org-sidebar-toggle {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
}

.org-sidebar-toggle-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
}

.org-dashboard-content {
  display: grid;
  gap: 1.5rem;
}

.org-dashboard-nav {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

.org-dashboard-link {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  color: #35556f;
  text-decoration: none;
  border: 1px solid transparent;
}

.org-dashboard-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: #f1f6fb;
  border: 1px solid #d7e4f0;
  font-size: 0.8rem;
  font-weight: 800;
}

.org-dashboard-link-label {
  white-space: nowrap;
}

.org-dashboard-link:hover {
  background: #f5f8fc;
  border-color: #d4deea;
}

.org-dashboard-link.active {
  background: #e8f2fc;
  border-color: #bfd4e8;
  color: #1f5d95;
  font-weight: 700;
}

.org-dashboard-shell.is-collapsed .org-dashboard-link {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 100%;
  max-width: 2.75rem;
  min-height: 3.6rem;
  padding: 0.8rem 0.35rem;
}

.org-dashboard-shell.is-collapsed .org-dashboard-link-label {
  display: none;
}

.org-dashboard-shell.is-collapsed .org-dashboard-sidebar {
  justify-items: center;
}

.org-dashboard-shell.is-collapsed .org-dashboard-nav {
  justify-items: center;
}

.org-dashboard-shell.is-collapsed .org-sidebar-toggle-icon {
  transform: rotate(180deg);
}

.workspace-card,
.org-card,
.metric-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d4deea;
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(18, 43, 66, 0.08);
}

.workspace-card {
  padding: 1rem;
}

.workspace-header {
  margin-bottom: 1.25rem;
}

.user-settings-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.75rem;
}

.user-settings-header-status {
  min-height: 1.5rem;
  text-align: right;
  color: #2f6f47;
  font-weight: 600;
}

.workspace-header h1,
.workspace-header h2 {
  margin-bottom: 0.5rem;
}

.workspace-subtitle {
  color: #5f7487;
  margin: 0;
}

@media (max-width: 767.98px) {
  .user-settings-header {
    align-items: start;
    flex-direction: column;
    min-height: 0;
  }

  .user-settings-header-status {
    text-align: left;
  }
}

.org-list,
.metrics-grid,
.member-list {
  display: grid;
  gap: 1rem;
}

.org-card {
  display: block;
  padding: 1.25rem;
  color: inherit;
  text-decoration: none;
}

.org-card:hover {
  border-color: #87a7c8;
}

.org-card-header,
.member-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.org-card h2,
.metric-card h2,
.member-row h3 {
  margin: 0;
}

.org-card p,
.member-row p,
.metric-card p {
  margin: 0.35rem 0 0;
  color: #5f7487;
}

.org-role-badge {
  border-radius: 999px;
  background: #e7f1fb;
  color: #215e98;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  white-space: nowrap;
}

.create-org-form .form-label {
  font-weight: 600;
}

.organization-type-form {
  display: grid;
  gap: 0.75rem;
}

.allowance-note {
  color: #5f7487;
  margin-bottom: 1rem;
}

.empty-state {
  padding: 1rem 0;
  color: #5f7487;
}

.workspace-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.workspace-meta span {
  border-radius: 999px;
  background: #f1f6fb;
  border: 1px solid #d7e4f0;
  color: #35556f;
  padding: 0.35rem 0.8rem;
  font-size: 0.92rem;
}

.metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 1.25rem;
}

.metric-value {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
}

.member-list {
  margin-top: 1rem;
}

.member-row {
  padding-top: 1rem;
  border-top: 1px solid #e3eaf2;
}

.member-row:first-child {
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 900px) {
  .workspace-grid,
  .metrics-grid,
  .org-dashboard-shell {
    grid-template-columns: 1fr;
  }

  .org-dashboard-sidebar {
    position: static;
  }

  .org-dashboard-shell.is-collapsed {
    grid-template-columns: 1fr;
  }

  .org-dashboard-shell.is-collapsed .org-dashboard-link {
    grid-template-columns: 2rem minmax(0, 1fr);
    justify-items: start;
  }

  .org-dashboard-shell.is-collapsed .org-dashboard-link-label {
    display: inline;
  }

  .org-switcher-label {
    min-width: 0;
  }
}

html[data-bs-theme="dark"] {
  color-scheme: dark;
}

html[data-bs-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(64, 135, 214, 0.22), transparent 28%),
    linear-gradient(180deg, #0d1620 0%, #121d29 100%);
  color: #d9e5f2;
}

html[data-bs-theme="dark"] .portal-nav {
  background: rgba(11, 18, 26, 0.88);
  border-color: rgba(118, 145, 170, 0.18);
}

html[data-bs-theme="dark"] .portal-badge,
html[data-bs-theme="dark"] .workspace-meta span,
html[data-bs-theme="dark"] .org-dashboard-link-icon,
html[data-bs-theme="dark"] .org-role-badge {
  background: #162838;
  border-color: #28445a;
  color: #d4e5f5;
}

html[data-bs-theme="dark"] .workspace-card,
html[data-bs-theme="dark"] .org-card,
html[data-bs-theme="dark"] .metric-card,
html[data-bs-theme="dark"] .hero-copy,
html[data-bs-theme="dark"] .status-card,
html[data-bs-theme="dark"] .auth-card,
html[data-bs-theme="dark"] .gateway-admin-item,
html[data-bs-theme="dark"] .meter-card,
html[data-bs-theme="dark"] .portal-modal,
html[data-bs-theme="dark"] .invite-preview-card,
html[data-bs-theme="dark"] .invite-created-card {
  background: rgba(15, 25, 36, 0.94);
  border-color: #22394b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

html[data-bs-theme="dark"] .workspace-subtitle,
html[data-bs-theme="dark"] .empty-state,
html[data-bs-theme="dark"] .notification-meta,
html[data-bs-theme="dark"] .org-card p,
html[data-bs-theme="dark"] .member-row p,
html[data-bs-theme="dark"] .metric-card p,
html[data-bs-theme="dark"] .invite-list-item p,
html[data-bs-theme="dark"] .auth-secondary-action,
html[data-bs-theme="dark"] .allowance-note,
html[data-bs-theme="dark"] .context-note {
  color: #96abc0;
}

html[data-bs-theme="dark"] .org-dashboard-link,
html[data-bs-theme="dark"] .profile-menu-name,
html[data-bs-theme="dark"] .profile-menu-section,
html[data-bs-theme="dark"] .notification-title,
html[data-bs-theme="dark"] .navbar-brand,
html[data-bs-theme="dark"] .nav-link,
html[data-bs-theme="dark"] .dropdown-item,
html[data-bs-theme="dark"] .dropdown-item-text {
  color: #d9e5f2 !important;
}

html[data-bs-theme="dark"] .org-dashboard-link:hover {
  background: #132435;
  border-color: #2b4860;
}

html[data-bs-theme="dark"] .org-dashboard-link.active {
  background: #17344d;
  border-color: #356483;
  color: #f2f7fc !important;
}

html[data-bs-theme="dark"] .notification-menu,
html[data-bs-theme="dark"] .dropdown-menu {
  background: #11202d;
  border-color: #23394b;
}

html[data-bs-theme="dark"] .notification-menu-header {
  background: #162838;
  border-bottom-color: #23394b;
}

html[data-bs-theme="dark"] .notification-item,
html[data-bs-theme="dark"] .invite-list-item,
html[data-bs-theme="dark"] .member-row,
html[data-bs-theme="dark"] .status-card dl div {
  border-color: #22394b;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
  background-color: #0f1b27;
  border-color: #2a4458;
  color: #d9e5f2;
}

html[data-bs-theme="dark"] .form-control::placeholder {
  color: #7f95aa;
}

html[data-bs-theme="dark"] .btn-outline-secondary {
  border-color: #3a5a73;
  color: #d9e5f2;
}

html[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background: #17344d;
  border-color: #4b7391;
  color: #f2f7fc;
}

.auth-card-wide {
  width: min(100%, 40rem);
}

.auth-secondary-action {
  margin: 1.25rem 0 0;
  color: #5f7487;
}

.invite-preview-card,
.invite-created-card {
  padding: 1rem 1.25rem;
  background: #f4f8fb;
  border: 1px solid #dbe6f0;
  border-radius: 16px;
}

.invite-preview-card {
  margin-bottom: 1.5rem;
}

.invite-list {
  display: grid;
  gap: 1rem;
}

.invite-list-item {
  padding-top: 1rem;
  border-top: 1px solid #e3eaf2;
}

.invite-list-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.invite-list-item p {
  margin: 0.35rem 0 0;
  color: #5f7487;
}

.invite-list-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.invite-list-header h3 {
  margin: 0;
}

.gateway-admin-list {
  display: grid;
  gap: 1rem;
}

.gateway-admin-list-spaced {
  margin-top: 1rem;
}

.gateway-admin-item,
.meter-card {
  border: 1px solid #e3eaf2;
  border-radius: 18px;
  background: #f9fbfd;
}

.gateway-admin-item {
  padding: 1.25rem;
}

.gateway-admin-summary {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

.gateway-admin-summary h3,
.meter-card h4 {
  margin: 0;
}

.gateway-admin-summary p,
.meter-card p {
  margin: 0.35rem 0 0;
  color: #5f7487;
}

.gateway-admin-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: end;
}

.gateway-meter-toggle {
  color: #215e98;
  font-weight: 700;
  text-decoration: none;
}

.gateway-meter-toggle:hover {
  color: #16324a;
}

.gateway-assignment-form {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

.gateway-admin-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gateway-form-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
}

.gateway-credential-form {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  align-items: end;
  margin-top: 1rem;
}

.gateway-assignment-form .form-select {
  max-width: 20rem;
}

.gateway-location-panel,
.meter-location-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(14rem, 1fr) minmax(18rem, 1.2fr);
  align-items: start;
  margin-top: 1rem;
}

.gateway-location-copy {
  display: grid;
  gap: 0.9rem;
}

.gateway-location-copy-compact {
  justify-items: center;
  text-align: center;
}

.gateway-location-copy .workspace-header,
.meter-location-card .workspace-header {
  margin-bottom: 0;
}

.gateway-location-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.gateway-location-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(170, 190, 206, 0.42);
  border-radius: 999px;
  background: rgba(244, 248, 251, 0.9);
  color: #35556f;
  font-size: 0.88rem;
}

.gateway-location-meta-compact {
  justify-content: center;
}

.gateway-location-more {
  position: relative;
  display: inline-grid;
  justify-items: center;
}

.gateway-location-more-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.15rem 0.65rem;
  border: 1px dashed rgba(115, 140, 163, 0.55);
  border-radius: 999px;
  color: #46667f;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: default;
}

.gateway-location-more-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 50%;
  z-index: 5;
  display: grid;
  gap: 0.3rem;
  min-width: 13rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d8e5ee;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 28px rgba(16, 34, 50, 0.12);
  color: #35556f;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 0.35rem);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.gateway-location-more:hover .gateway-location-more-panel,
.gateway-location-more:focus-within .gateway-location-more-panel {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.gateway-location-more-panel p {
  margin: 0;
  font-size: 0.82rem;
}

.gateway-location-link,
.gateway-location-link-inline {
  color: #215e98;
  font-weight: 700;
  text-decoration: none;
}

.gateway-location-link {
  justify-self: start;
}

.gateway-location-link-inline:hover,
.gateway-location-link:hover {
  color: #16324a;
  text-decoration: underline;
}

.gateway-location-map-shell {
  overflow: hidden;
  border: 1px solid #d8e5ee;
  border-radius: 18px;
  background: #f5f9fc;
  min-height: 16rem;
}

.gateway-location-map-shell-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 34rem;
  width: 100%;
  margin-inline: auto;
}

.gateway-location-map {
  display: block;
  width: 100%;
  min-height: 16rem;
  border: 0;
}

.meter-location-card-prominent {
  grid-column: 1 / -1;
}

.meter-location-layout-prominent {
  grid-template-columns: 1fr;
  justify-items: center;
}

.meter-telemetry-card {
  display: grid;
  gap: 1.1rem;
}

.meter-telemetry-summary {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.meter-telemetry-stat {
  padding: 0.95rem 1rem;
  border: 1px solid #d8e5ee;
  border-radius: 16px;
  background: #f7fafc;
}

.meter-telemetry-stat dt {
  margin: 0;
  color: #71879c;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meter-telemetry-stat dt sub {
  font-size: 0.72em;
  vertical-align: sub;
}

.meter-telemetry-stat dt.metric-label-natural {
  letter-spacing: 0.04em;
  text-transform: none;
}

.meter-telemetry-stat dd {
  margin: 0.35rem 0 0;
  color: #15304a;
  font-size: 1.35rem;
  font-weight: 750;
}

.meter-telemetry-chart-card {
  padding: 1rem;
  border: 1px solid #d8e5ee;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

.meter-telemetry-chart-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 0.9rem;
}

.meter-telemetry-chart-header h3 {
  margin: 0;
  color: #15304a;
  font-size: 1rem;
}

.meter-telemetry-chart-header span {
  color: #5f7487;
  font-size: 0.88rem;
  font-weight: 600;
}

.meter-telemetry-chart-shell {
  position: relative;
  height: 13rem;
  min-height: 13rem;
  padding: 0.5rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(241, 247, 252, 0.92) 100%);
}

.meter-telemetry-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.meter-telemetry-chart-canvas {
  display: block;
  width: 100%;
  height: 100% !important;
}

.meter-telemetry-chart-line {
  fill: none;
  stroke: #1f6fb2;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meter-telemetry-chart-labels {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  color: #5f7487;
  font-size: 0.82rem;
  font-weight: 600;
}

.meter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.meter-grid-collapsible {
  margin-top: 1rem;
}

.meter-card {
  --meter-accent: #7c96ae;
  position: relative;
  display: grid;
  gap: 1rem;
  min-height: 11.5rem;
  padding: 1.1rem 1.1rem 1rem;
  border: 1px solid rgba(164, 186, 204, 0.36);
  border-radius: var(--portal-radius-card);
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.12), transparent 28%),
    linear-gradient(155deg, #ffffff 0%, #f5f9fc 54%, #edf4f8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 18px 34px rgba(16, 34, 50, 0.08);
  overflow: hidden;
}

.org-members-grid {
  align-items: start;
}

.meter-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.35rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--meter-accent) 92%, white), var(--meter-accent));
}

.meter-card.meter-tone-good {
  --meter-accent: #24b45b;
}

.meter-card.meter-tone-warning {
  --meter-accent: #f59e0b;
}

.meter-card.meter-tone-offline {
  --meter-accent: #94a7ba;
}

.meter-card.meter-tone-busy {
  --meter-accent: #2378d6;
}

.meter-card.meter-tone-neutral {
  --meter-accent: #7c96ae;
}

.meter-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.meter-card-copy {
  min-width: 0;
}

.meter-card-kicker {
  margin: 0 0 0.35rem;
  color: #62819c;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meter-card h4 {
  color: #15304a;
  font-size: 1.12rem;
  line-height: 1.2;
}

.meter-card-status {
  display: grid;
  justify-items: end;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.meter-health-light {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  background: var(--meter-accent);
  box-shadow: 0 0 0.9rem 0.18rem color-mix(in srgb, var(--meter-accent) 72%, transparent);
}

.meter-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.9rem;
  max-width: 11rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.meter-status-badge > span:last-child {
  display: inline-flex;
  align-items: center;
  min-height: 1rem;
}

.meter-status-good {
  background: rgba(36, 180, 91, 0.16);
  color: #17633a;
}

.meter-status-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #85520a;
}

.meter-status-offline {
  background: rgba(148, 167, 186, 0.22);
  color: #4f6579;
}

.meter-status-busy {
  background: rgba(35, 120, 214, 0.18);
  color: #165393;
}

.meter-status-neutral {
  background: rgba(124, 150, 174, 0.18);
  color: #4d667e;
}

.meter-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.meter-meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.2rem 0.7rem;
  border: 1px solid rgba(170, 190, 206, 0.42);
  border-radius: 999px;
  background: rgba(232, 241, 247, 0.9);
  color: #496781;
  font-size: 0.82rem;
  font-weight: 600;
}

.meter-meta-chip-metric {
  border-color: rgba(31, 111, 178, 0.24);
  background: rgba(31, 111, 178, 0.1);
  color: #165393;
  font-weight: 750;
}

.meter-run-state {
  display: inline-grid;
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  align-self: center;
  place-items: center;
  border-radius: 999px;
}

.meter-run-state svg {
  width: 0.9rem;
  height: 0.9rem;
  display: block;
}

.state-running {
  background: rgba(220, 248, 232, 0.95);
  color: #177a3c;
}

.state-connected {
  background: rgba(220, 248, 232, 0.95);
  color: #177a3c;
}

.state-paused {
  background: rgba(255, 240, 206, 0.95);
  color: #b77900;
}

.state-stopped {
  background: rgba(255, 227, 232, 0.95);
  color: #be253a;
}

.state-calibrating {
  background: rgba(255, 240, 206, 0.95);
  color: #c76a00;
}

.state-error {
  background: transparent;
  color: #c76a00;
}

.state-powering-on,
.state-initializing,
.state-store {
  background: rgba(228, 240, 255, 0.95);
  color: #1769c2;
}

.state-unknown {
  background: rgba(237, 242, 246, 0.95);
  color: #60768d;
}

html[data-bs-theme="dark"] .meter-card {
  border-color: rgba(111, 136, 160, 0.22);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.06), transparent 28%),
    linear-gradient(155deg, #203545 0%, #172633 54%, #12202b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 34px rgba(0, 0, 0, 0.32);
}

html[data-bs-theme="dark"] .meter-card-kicker {
  color: #8fa8be;
}

html[data-bs-theme="dark"] .meter-meta-chip {
  border-color: rgba(132, 154, 175, 0.16);
  background: rgba(9, 17, 24, 0.3);
  color: #c8d6e3;
}

html[data-bs-theme="dark"] .meter-meta-chip-metric {
  border-color: rgba(127, 226, 240, 0.2);
  background: rgba(127, 226, 240, 0.12);
  color: #9ce8f3;
}

html[data-portal-theme="dark-ld"] .workspace-card,
html[data-portal-theme="dark-ld"] .hero-copy,
html[data-portal-theme="dark-ld"] .status-card,
html[data-portal-theme="dark-ld"] .auth-card,
html[data-portal-theme="dark-ld"] .portal-modal,
html[data-portal-theme="dark-ld"] .invite-preview-card,
html[data-portal-theme="dark-ld"] .invite-created-card,
html[data-portal-theme="dark-ld"] .gateway-admin-item,
html[data-portal-theme="dark-ld"] .metric-card,
html[data-portal-theme="dark-ld"] .meter-card {
  border-color: var(--portal-border);
  background:
    radial-gradient(circle at top right, rgba(31, 143, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(13, 27, 46, 0.96) 0%, rgba(16, 36, 58, 0.98) 100%);
  box-shadow: 0 16px 30px rgba(2, 9, 18, 0.26);
}

html[data-portal-theme="dark-ld"] .meter-card-kicker {
  color: #9db8d3;
}

html[data-portal-theme="dark-ld"] .meter-card h4 {
  color: #f4f8fc;
}

html[data-portal-theme="dark-ld"] .meter-meta-chip {
  border-color: rgba(58, 90, 120, 0.42);
  background: rgba(9, 22, 36, 0.34);
  color: #d6e4f1;
}

html[data-portal-theme="dark-ld"] .meter-meta-chip-metric {
  border-color: rgba(104, 190, 255, 0.28);
  background: rgba(50, 133, 208, 0.16);
  color: #9fd9ff;
}

@media (max-width: 700px) {
  .gateway-admin-summary,
  .gateway-assignment-form {
    flex-direction: column;
    align-items: stretch;
  }

  .gateway-admin-grid,
  .gateway-credential-form {
    grid-template-columns: 1fr;
  }

  .gateway-admin-meta {
    justify-content: start;
  }

  .gateway-assignment-form .form-select {
    max-width: none;
  }

  .meter-card {
    min-height: 0;
  }

  .meter-card-header {
    flex-direction: column;
  }

  .meter-card-status {
    justify-items: start;
  }
}

:root,
html[data-portal-theme="light"] {
  --portal-bg: #0f1821;
  --portal-bg-soft: #16222d;
  --portal-surface: rgba(246, 250, 252, 0.96);
  --portal-surface-strong: #ffffff;
  --portal-surface-muted: #eef5f9;
  --portal-border: #d6e3ed;
  --portal-border-strong: #c3d6e4;
  --portal-text: #102538;
  --portal-text-muted: #55708d;
  --portal-text-soft: #7b91a7;
  --portal-accent: #14b8a6;
  --portal-accent-strong: #0d8f86;
  --portal-accent-soft: #d8f6f1;
  --portal-blue: #2378d6;
  --portal-danger: #d94b5f;
  --portal-shadow: 0 22px 48px rgba(13, 32, 48, 0.12);
  --portal-body-background:
    radial-gradient(circle at 14% 8%, rgba(20, 184, 166, 0.12), transparent 24%),
    radial-gradient(circle at 84% 2%, rgba(35, 120, 214, 0.12), transparent 22%),
    linear-gradient(180deg, #f8fbfd 0%, #f3f8fb 38%, #eef4f8 100%);
  --portal-link: #0d6f86;
  --portal-link-hover: #084f61;
  --portal-nav-background:
    radial-gradient(circle at 16% 28%, rgba(36, 180, 91, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(8, 34, 52, 0.96) 0%, rgba(9, 39, 59, 0.94) 100%);
  --portal-nav-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  --portal-brand-text: #f5fbff;
  --portal-brand-mark-background: linear-gradient(135deg, #17bea9, #0d6f86);
  --portal-brand-mark-color: #ffffff;
  --portal-brand-mark-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  --portal-nav-link-text: rgba(228, 238, 247, 0.88);
  --portal-nav-link-active-text: #ffffff;
  --portal-nav-link-active-background: rgba(93, 168, 197, 0.22);
  --portal-nav-link-active-border: rgba(124, 183, 208, 0.2);
  --portal-badge-border: rgba(121, 186, 211, 0.36);
  --portal-badge-background: rgba(226, 244, 250, 0.18);
  --portal-badge-text: #eefbff;
  --portal-badge-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --portal-footer-border: rgba(185, 205, 219, 0.42);
  --portal-footer-background: rgba(238, 244, 248, 0.9);
  --portal-footer-text: #5e7489;
  --portal-footer-link: #345d7b;
  --portal-footer-shadow: 0 -10px 28px rgba(12, 25, 37, 0.08);
  --portal-workspace-header-title: #f5fbff;
  --portal-workspace-header-subtitle: #f5fbff;
  --portal-workspace-header-eyebrow: #f5fbff;
  --portal-eyebrow: #74d7e5;
  --portal-primary-button-border: #0f9a91;
  --portal-primary-button-background: linear-gradient(135deg, var(--portal-accent) 0%, var(--portal-accent-strong) 100%);
  --portal-primary-button-hover-border: #0b7d74;
  --portal-primary-button-hover-background: linear-gradient(135deg, #10a998 0%, #0c8178 100%);
  --portal-secondary-button-border: #bdd0dd;
  --portal-secondary-button-background: #ffffff;
  --portal-secondary-button-text: #173651;
  --portal-secondary-button-hover-border: #8fb2c8;
  --portal-secondary-button-hover-background: #eef7fb;
  --portal-secondary-button-hover-text: #10283d;
  --portal-field-background: #fbfdff;
  --portal-field-focus-border: #5cb8cb;
  --portal-field-focus-ring: rgba(20, 184, 166, 0.16);
  --portal-dropdown-border: #d1e1eb;
  --portal-dropdown-background: #ffffff;
  --portal-dropdown-shadow: 0 18px 40px rgba(16, 34, 50, 0.16);
  --portal-dropdown-header-background: #eff7fb;
  --portal-org-card-border: rgba(142, 180, 202, 0.24);
  --portal-org-card-background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.12), transparent 26%),
    linear-gradient(145deg, rgba(19, 31, 42, 0.96), rgba(15, 24, 34, 0.96));
  --portal-org-card-text: #edf5fb;
  --portal-org-card-subtext: #bed1e2;
  --portal-org-card-shadow: 0 20px 40px rgba(8, 18, 27, 0.24);
  --portal-org-card-accent: linear-gradient(180deg, #1bd3b0, #0d6f86);
  --portal-chip-border: #cae0ec;
  --portal-chip-background: #eef7fb;
  --portal-chip-text: #224d6b;
  --portal-chip-strong: #14314a;
  --portal-role-background: linear-gradient(180deg, #e4f7f4 0%, #d5f2ed 100%);
  --portal-role-text: #0d6f61;
  --portal-active-nav-surface: linear-gradient(180deg, #e5f4fb 0%, #d9eef8 100%);
  --portal-active-nav-border: #b7d6e7;
  --portal-active-nav-text: #123f5c;
  --portal-active-nav-icon-background: rgba(255, 255, 255, 0.9);
  --portal-active-nav-icon-border: #bcd9e8;
  --portal-active-nav-icon-text: #0f6d83;
  --portal-radius-panel: 10px;
  --portal-radius-card: 7px;
  --portal-radius-control: 5px;
  --portal-radius-chip: 5px;
}

html[data-portal-theme="dark"] {
  --portal-surface: rgba(17, 29, 40, 0.96);
  --portal-surface-strong: rgba(13, 24, 35, 0.96);
  --portal-surface-muted: #162838;
  --portal-border: #22394b;
  --portal-border-strong: #2a4458;
  --portal-text: #e1ebf4;
  --portal-text-muted: #9db3c6;
  --portal-text-soft: #8fa5b7;
  --portal-body-background:
    linear-gradient(rgba(8, 13, 19, 0.84), rgba(8, 13, 19, 0.84)),
    radial-gradient(circle at 18% 10%, rgba(20, 184, 166, 0.18), transparent 26%),
    radial-gradient(circle at 82% 0%, rgba(35, 120, 214, 0.2), transparent 24%),
    linear-gradient(180deg, #0c141c 0%, #0e1821 22%, #111d28 22%, #111d28 100%);
  --portal-link: #7bd7eb;
  --portal-link-hover: #9ce8f3;
  --portal-nav-background:
    radial-gradient(circle at 16% 28%, rgba(36, 180, 91, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(8, 34, 52, 0.96) 0%, rgba(9, 39, 59, 0.94) 100%);
  --portal-nav-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  --portal-brand-text: #f5fbff;
  --portal-brand-mark-background: linear-gradient(135deg, #17bea9, #0d6f86);
  --portal-brand-mark-color: #ffffff;
  --portal-brand-mark-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  --portal-nav-link-text: rgba(228, 238, 247, 0.88);
  --portal-nav-link-active-text: #ffffff;
  --portal-nav-link-active-background: rgba(93, 168, 197, 0.22);
  --portal-nav-link-active-border: rgba(124, 183, 208, 0.2);
  --portal-badge-border: rgba(121, 186, 211, 0.36);
  --portal-badge-background: rgba(226, 244, 250, 0.18);
  --portal-badge-text: #eefbff;
  --portal-badge-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --portal-footer-border: rgba(64, 92, 117, 0.44);
  --portal-footer-background: rgba(10, 18, 25, 0.9);
  --portal-footer-text: #8fa5b7;
  --portal-footer-link: #bfd2e3;
  --portal-footer-shadow: 0 -12px 30px rgba(0, 0, 0, 0.32);
  --portal-workspace-header-title: #f4f9fd;
  --portal-workspace-header-subtitle: #f4f9fd;
  --portal-workspace-header-eyebrow: #f4f9fd;
  --portal-eyebrow: #74d7e5;
  --portal-primary-button-border: #0f9a91;
  --portal-primary-button-background: linear-gradient(135deg, var(--portal-accent) 0%, var(--portal-accent-strong) 100%);
  --portal-primary-button-hover-border: #0b7d74;
  --portal-primary-button-hover-background: linear-gradient(135deg, #10a998 0%, #0c8178 100%);
  --portal-secondary-button-border: #34556f;
  --portal-secondary-button-background: #132434;
  --portal-secondary-button-text: #e1ecf4;
  --portal-secondary-button-hover-border: #446d8c;
  --portal-secondary-button-hover-background: #17344d;
  --portal-secondary-button-hover-text: #f5fbff;
  --portal-field-background: #0f1b27;
  --portal-field-focus-border: #5cb8cb;
  --portal-field-focus-ring: rgba(20, 184, 166, 0.16);
  --portal-dropdown-border: #22394b;
  --portal-dropdown-background: #12202d;
  --portal-dropdown-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  --portal-dropdown-header-background: #162838;
  --portal-org-card-border: rgba(111, 136, 160, 0.24);
  --portal-org-card-background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.06), transparent 28%),
    linear-gradient(155deg, #203545 0%, #172633 54%, #12202b 100%);
  --portal-org-card-text: #f4f8fc;
  --portal-org-card-subtext: #c8d6e3;
  --portal-org-card-shadow: 0 18px 34px rgba(0, 0, 0, 0.32);
  --portal-org-card-accent: linear-gradient(180deg, #1bd3b0, #0d6f86);
  --portal-chip-border: #28445a;
  --portal-chip-background: #162838;
  --portal-chip-text: #d4e5f5;
  --portal-chip-strong: #f4f9fd;
  --portal-role-background: #162838;
  --portal-role-text: #d4e5f5;
  --portal-active-nav-surface: linear-gradient(180deg, rgba(38, 62, 82, 0.98) 0%, rgba(24, 43, 60, 0.98) 100%);
  --portal-active-nav-border: #35566f;
  --portal-active-nav-text: #f2f8fd;
  --portal-active-nav-icon-background: #193043;
  --portal-active-nav-icon-border: #35566f;
  --portal-active-nav-icon-text: #e2edf6;
}

html[data-portal-theme="ld"] {
  --portal-surface: rgba(255, 255, 255, 0.98);
  --portal-surface-strong: #ffffff;
  --portal-surface-muted: #f4f5f7;
  --portal-border: #c8cbd1;
  --portal-border-strong: #b7bcc4;
  --portal-text: #2f3d4b;
  --portal-text-muted: #58585b;
  --portal-text-soft: #737376;
  --portal-accent: #005eb8;
  --portal-accent-strong: #004f9c;
  --portal-accent-soft: rgba(0, 94, 184, 0.1);
  --portal-blue: #005eb8;
  --portal-shadow: 0 18px 36px rgba(24, 54, 92, 0.08);
  --portal-body-background: linear-gradient(180deg, #fdfefe 0%, #f7f9fc 100%);
  --portal-link: #005eb8;
  --portal-link-hover: #004f9c;
  --portal-nav-background: linear-gradient(180deg, #005eb8 0%, #004f9c 100%);
  --portal-nav-shadow: 0 10px 24px rgba(15, 54, 98, 0.22);
  --portal-brand-text: #ffffff;
  --portal-brand-mark-background: linear-gradient(135deg, #ffffff, #e9edf2);
  --portal-brand-mark-color: #005eb8;
  --portal-brand-mark-shadow: 0 8px 18px rgba(14, 53, 94, 0.18);
  --portal-nav-link-text: rgba(255, 255, 255, 0.92);
  --portal-nav-link-active-text: #ffffff;
  --portal-nav-link-active-background: rgba(255, 255, 255, 0.14);
  --portal-nav-link-active-border: rgba(255, 255, 255, 0.18);
  --portal-badge-border: rgba(255, 255, 255, 0.22);
  --portal-badge-background: rgba(255, 255, 255, 0.18);
  --portal-badge-text: #ffffff;
  --portal-badge-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --portal-footer-border: rgba(210, 219, 232, 0.85);
  --portal-footer-background: rgba(255, 255, 255, 0.94);
  --portal-footer-text: #58585b;
  --portal-footer-link: #005eb8;
  --portal-footer-shadow: 0 -8px 18px rgba(23, 49, 82, 0.06);
  --portal-workspace-header-title: #2f3d4b;
  --portal-workspace-header-subtitle: #58585b;
  --portal-workspace-header-eyebrow: #005eb8;
  --portal-eyebrow: #005eb8;
  --portal-primary-button-border: #ea6410;
  --portal-primary-button-background: linear-gradient(135deg, #ff8a2d 0%, #ea6410 100%);
  --portal-primary-button-hover-border: #cf5810;
  --portal-primary-button-hover-background: linear-gradient(135deg, #ff943d 0%, #d95d0d 100%);
  --portal-secondary-button-border: #c8cbd1;
  --portal-secondary-button-background: #ffffff;
  --portal-secondary-button-text: #58585b;
  --portal-secondary-button-hover-border: #aeb3bb;
  --portal-secondary-button-hover-background: #f4f5f7;
  --portal-secondary-button-hover-text: #414145;
  --portal-field-background: #ffffff;
  --portal-field-focus-border: #005eb8;
  --portal-field-focus-ring: rgba(0, 94, 184, 0.14);
  --portal-dropdown-border: #c0c5cd;
  --portal-dropdown-background: #ffffff;
  --portal-dropdown-shadow: 0 18px 34px rgba(24, 54, 92, 0.12);
  --portal-dropdown-header-background: #f4f5f7;
  --portal-org-card-border: #c7cbd2;
  --portal-org-card-background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 253, 0.98) 100%);
  --portal-org-card-text: #2f3d4b;
  --portal-org-card-subtext: #58585b;
  --portal-org-card-shadow: 0 16px 28px rgba(24, 54, 92, 0.08);
  --portal-org-card-accent: linear-gradient(180deg, #005eb8, #58585b);
  --portal-chip-border: #ccd0d6;
  --portal-chip-background: #f4f5f7;
  --portal-chip-text: #58585b;
  --portal-chip-strong: #2f3d4b;
  --portal-role-background: linear-gradient(180deg, rgba(0, 94, 184, 0.1) 0%, rgba(88, 88, 91, 0.08) 100%);
  --portal-role-text: #005eb8;
  --portal-active-nav-surface: linear-gradient(180deg, rgba(0, 94, 184, 0.08) 0%, rgba(88, 88, 91, 0.08) 100%);
  --portal-active-nav-border: #c1c7cf;
  --portal-active-nav-text: #005eb8;
  --portal-active-nav-icon-background: #ffffff;
  --portal-active-nav-icon-border: #ccd0d6;
  --portal-active-nav-icon-text: #005eb8;
}

html[data-portal-theme="dark-ld"] {
  --bg: #07111f;
  --bg-elevated: #0d1b2e;
  --bg-card: #10243a;
  --text: #f4f8fc;
  --text-muted: #a9b8c8;
  --brand-blue: #005eb8;
  --brand-blue-bright: #2d7dcb;
  --accent-orange: #58585b;
  --border: #2e3947;
  --portal-surface: rgba(13, 27, 46, 0.96);
  --portal-surface-strong: rgba(16, 36, 58, 0.98);
  --portal-surface-muted: #10243a;
  --portal-border: #2e3947;
  --portal-border-strong: #425062;
  --portal-text: #f4f8fc;
  --portal-text-muted: #aab2bc;
  --portal-text-soft: #7f8b98;
  --portal-accent: #005eb8;
  --portal-accent-strong: #2d7dcb;
  --portal-accent-soft: rgba(0, 94, 184, 0.16);
  --portal-blue: #2d7dcb;
  --portal-shadow: 0 18px 34px rgba(2, 9, 18, 0.32);
  --portal-body-background:
    radial-gradient(circle at 12% 8%, rgba(0, 94, 184, 0.16), transparent 26%),
    radial-gradient(circle at 88% 0%, rgba(88, 88, 91, 0.12), transparent 24%),
    linear-gradient(180deg, #07111f 0%, #091524 26%, #0c192b 58%, #07111f 100%);
  --portal-link: #5ea4e4;
  --portal-link-hover: #8dc1ef;
  --portal-nav-background:
    linear-gradient(180deg, rgba(0, 94, 184, 1) 0%, rgba(0, 79, 156, 1) 52%, rgba(6, 56, 110, 0.98) 100%);
  --portal-nav-shadow: 0 16px 28px rgba(0, 17, 34, 0.34);
  --portal-brand-text: #f8fbff;
  --portal-brand-mark-background: linear-gradient(135deg, #f5f9ff, #d7dde5);
  --portal-brand-mark-color: #005eb8;
  --portal-brand-mark-shadow: 0 8px 18px rgba(2, 10, 20, 0.28);
  --portal-nav-link-text: rgba(243, 248, 253, 0.92);
  --portal-nav-link-active-text: #ffffff;
  --portal-nav-link-active-background: rgba(0, 94, 184, 0.24);
  --portal-nav-link-active-border: rgba(130, 182, 229, 0.36);
  --portal-badge-border: rgba(88, 88, 91, 0.4);
  --portal-badge-background: rgba(9, 48, 85, 0.66);
  --portal-badge-text: #ffffff;
  --portal-badge-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --portal-footer-border: rgba(46, 57, 71, 0.9);
  --portal-footer-background: rgba(9, 18, 31, 0.94);
  --portal-footer-text: #93a7bc;
  --portal-footer-link: #5ea4e4;
  --portal-footer-shadow: 0 -10px 22px rgba(2, 9, 18, 0.26);
  --portal-workspace-header-title: #f4f8fc;
  --portal-workspace-header-subtitle: #b8c7d6;
  --portal-workspace-header-eyebrow: #8dc1ef;
  --portal-eyebrow: #8dc1ef;
  --portal-primary-button-border: #ea6410;
  --portal-primary-button-background: linear-gradient(135deg, #ff8a2d 0%, #ea6410 100%);
  --portal-primary-button-hover-border: #cf5810;
  --portal-primary-button-hover-background: linear-gradient(135deg, #ff943d 0%, #d95d0d 100%);
  --portal-secondary-button-border: #425062;
  --portal-secondary-button-background: #0d1b2e;
  --portal-secondary-button-text: #e3edf7;
  --portal-secondary-button-hover-border: #58585b;
  --portal-secondary-button-hover-background: #122740;
  --portal-secondary-button-hover-text: #f8fbff;
  --portal-field-background: #0d1b2e;
  --portal-field-focus-border: #2d7dcb;
  --portal-field-focus-ring: rgba(0, 94, 184, 0.24);
  --portal-dropdown-border: #2e3947;
  --portal-dropdown-background: #0d1b2e;
  --portal-dropdown-shadow: 0 18px 36px rgba(2, 9, 18, 0.34);
  --portal-dropdown-header-background: #10243a;
  --portal-org-card-border: rgba(46, 57, 71, 0.92);
  --portal-org-card-background:
    radial-gradient(circle at top right, rgba(0, 94, 184, 0.1), transparent 24%),
    linear-gradient(160deg, #10243a 0%, #0d1b2e 58%, #0a1524 100%);
  --portal-org-card-text: #f4f8fc;
  --portal-org-card-subtext: #aebfd0;
  --portal-org-card-shadow: 0 18px 30px rgba(2, 9, 18, 0.28);
  --portal-org-card-accent: linear-gradient(180deg, #005eb8, #58585b);
  --portal-chip-border: #3b495a;
  --portal-chip-background: #10243a;
  --portal-chip-text: #d9e6f2;
  --portal-chip-strong: #f4f9fd;
  --portal-role-background: linear-gradient(180deg, rgba(0, 94, 184, 0.26) 0%, rgba(39, 48, 60, 0.95) 100%);
  --portal-role-text: #d8ebff;
  --portal-active-nav-surface: linear-gradient(180deg, rgba(0, 94, 184, 0.22) 0%, rgba(16, 36, 58, 0.98) 100%);
  --portal-active-nav-border: #58585b;
  --portal-active-nav-text: #f4f8fc;
  --portal-active-nav-icon-background: #0d1b2e;
  --portal-active-nav-icon-border: #4a596b;
  --portal-active-nav-icon-text: #8dc1ef;
}

html {
  min-height: 100%;
}

body.portal-shell {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--portal-body-background);
  color: var(--portal-text);
}

a {
  color: var(--portal-link);
  text-decoration-color: color-mix(in srgb, var(--portal-link) 25%, transparent);
}

a:hover {
  color: var(--portal-link-hover);
}

.portal-content-shell {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  padding-bottom: 5.25rem;
}

.portal-nav-shell,
.portal-content-shell,
.portal-footer-shell {
  width: 100%;
  max-width: min(1840px, calc(100vw - 2rem));
  margin-inline: auto;
  padding-inline: clamp(0.75rem, 1.8vw, 1.5rem);
}

.portal-nav {
  margin: 0 0 1.75rem;
  padding: 0.125rem 0;
  border: 0;
  background: var(--portal-nav-background);
  box-shadow: var(--portal-nav-shadow);
  backdrop-filter: blur(14px);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--portal-brand-text) !important;
  font-size: 1.2rem;
  font-weight: 780;
  letter-spacing: 0.01em;
}

.portal-brand-mark {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 999px;
  background: var(--portal-brand-mark-background);
  color: var(--portal-brand-mark-color);
  box-shadow: var(--portal-brand-mark-shadow);
}

.portal-brand-mark svg {
  width: 1.4rem;
  height: 1.4rem;
}

.portal-primary-nav {
  gap: 0.35rem;
  margin-left: 1.4rem;
}

.portal-nav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.5rem 0.95rem !important;
  color: var(--portal-nav-link-text) !important;
  font-weight: 650;
}

.portal-nav-link:hover,
.portal-nav-link.active {
  color: var(--portal-nav-link-active-text) !important;
  background: var(--portal-nav-link-active-background);
  border-color: var(--portal-nav-link-active-border);
}

.portal-badge {
  border-color: var(--portal-badge-border);
  background: var(--portal-badge-background);
  color: var(--portal-badge-text);
  box-shadow: var(--portal-badge-shadow);
}

.portal-user,
.navbar-text,
.navbar-brand,
.nav-link,
.dropdown-item-text,
.dropdown-item {
  color: var(--portal-text);
}

.dropdown-menu .profile-menu-name,
.dropdown-menu .dropdown-item-text,
.dropdown-menu .dropdown-item,
.dropdown-menu .profile-menu-submit {
  color: #17324a;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus,
.dropdown-menu .profile-menu-submit:hover,
.dropdown-menu .profile-menu-submit:focus {
  color: #10283d;
}

.workspace-shell,
.org-dashboard-content,
.workspace-grid {
  position: relative;
}

.workspace-header h1,
.workspace-header h2,
.hero-copy h1,
.auth-card h1,
.dummy-header h1 {
  color: #f7fbff;
}

.workspace-card .workspace-header h2,
.workspace-card .workspace-header h3,
.metric-card h2,
.gateway-admin-item h3,
.gateway-admin-item h4,
.portal-modal .modal-title,
.invite-list-header h3,
.org-card h2 {
  color: var(--portal-text);
}

.org-card h2 {
  color: #f1f8fe;
}

.workspace-header .workspace-subtitle,
.workspace-header .lead,
.context-note,
.auth-secondary-action,
.auth-card .lead {
  color: rgba(219, 232, 244, 0.74);
}

.workspace-card .workspace-header .workspace-subtitle,
.metric-card p,
.gateway-admin-summary p,
.gateway-admin-item .empty-state,
.invite-list-item p,
.invite-preview-card,
.invite-created-card,
.allowance-note,
.auth-card .auth-secondary-action {
  color: var(--portal-text-muted);
}

.workspace-header {
  margin-bottom: 1.25rem;
}

.workspace-shell > .workspace-header,
.auth-shell > .auth-card > .lead,
.hero-panel {
  position: relative;
  z-index: 1;
}

.workspace-shell > .workspace-header h1,
.workspace-shell > .workspace-header .workspace-subtitle,
.workspace-shell > .workspace-header .eyebrow {
  color: var(--portal-workspace-header-title);
}

.workspace-shell > .user-settings-header h1 {
  color: var(--portal-text);
}

.workspace-shell > .user-settings-header .eyebrow {
  color: #2c6fb7;
}

.workspace-shell > .user-settings-header .workspace-subtitle {
  color: var(--portal-text-muted);
}

.eyebrow {
  color: var(--portal-eyebrow);
}

.workspace-card,
.org-card,
.metric-card,
.auth-card,
.hero-copy,
.status-card,
.portal-modal,
.invite-preview-card,
.invite-created-card,
.gateway-admin-item {
  border: 1px solid var(--portal-border);
  background: linear-gradient(180deg, var(--portal-surface) 0%, var(--portal-surface-strong) 100%);
  box-shadow: var(--portal-shadow);
}

.workspace-card,
.org-card,
.metric-card,
.hero-copy,
.status-card,
.auth-card {
  border-radius: var(--portal-radius-panel);
}

.workspace-card,
.hero-copy,
.status-card,
.auth-card {
  padding: 1.3rem 1.4rem;
}

.gateway-admin-item,
.invite-preview-card,
.invite-created-card,
.portal-modal {
  border-radius: var(--portal-radius-card);
}

.org-card,
.metric-card,
.gateway-admin-item {
  overflow: hidden;
}

.org-card {
  position: relative;
  border-color: var(--portal-org-card-border);
  background: var(--portal-org-card-background);
  color: var(--portal-org-card-text);
  box-shadow: var(--portal-org-card-shadow);
}

.org-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.35rem;
  background: var(--portal-org-card-accent);
}

.org-card:hover {
  border-color: rgba(113, 184, 204, 0.38);
  transform: translateY(-1px);
}

.org-card p,
.org-card .workspace-meta span {
  color: var(--portal-org-card-subtext);
}

.org-role-badge,
.workspace-meta span,
.org-dashboard-link-icon {
  border-color: var(--portal-chip-border);
  background: var(--portal-chip-background);
  color: var(--portal-chip-text);
}

.org-role-badge {
  background: var(--portal-role-background);
  color: var(--portal-role-text);
}

.workspace-meta span strong {
  color: var(--portal-chip-strong);
}

.org-dashboard-link {
  border-radius: var(--portal-radius-chip);
}

.org-dashboard-link.active {
  background: var(--portal-active-nav-surface);
  border-color: var(--portal-active-nav-border);
  color: var(--portal-active-nav-text);
}

.org-dashboard-link.active .org-dashboard-link-icon {
  background: var(--portal-active-nav-icon-background);
  border-color: var(--portal-active-nav-icon-border);
  color: var(--portal-active-nav-icon-text);
}

.btn {
  border-radius: var(--portal-radius-control);
  font-weight: 700;
  box-shadow: none;
}

.btn-primary {
  border-color: var(--portal-primary-button-border);
  background: var(--portal-primary-button-background);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  border-color: var(--portal-primary-button-hover-border) !important;
  background: var(--portal-primary-button-hover-background) !important;
  color: #fff !important;
}

.btn-outline-secondary {
  border-color: var(--portal-secondary-button-border);
  background: var(--portal-secondary-button-background);
  color: var(--portal-secondary-button-text);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  border-color: var(--portal-secondary-button-hover-border);
  background: var(--portal-secondary-button-hover-background);
  color: var(--portal-secondary-button-hover-text);
}

.btn-danger,
.btn-outline-danger:hover {
  border-color: #c44356;
  background: linear-gradient(135deg, #de596b 0%, #c44356 100%);
  color: #fff;
}

.form-control,
.form-select {
  min-height: 2.9rem;
  border-color: var(--portal-border-strong);
  border-radius: var(--portal-radius-control);
  background: var(--portal-field-background);
  color: var(--portal-text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--portal-field-focus-border);
  box-shadow: 0 0 0 0.18rem var(--portal-field-focus-ring);
}

.dropdown-menu,
.notification-menu {
  border-color: var(--portal-dropdown-border);
  background: var(--portal-dropdown-background);
  border-radius: var(--portal-radius-panel);
  box-shadow: var(--portal-dropdown-shadow);
}

.notification-menu-header {
  background: var(--portal-dropdown-header-background);
}

.alert-info {
  border-color: #c5dcee;
  background: linear-gradient(180deg, #edf7ff 0%, #e5f2fb 100%);
  color: #173d5b;
}

.auth-shell {
  padding-top: 3rem;
}

.auth-card,
.hero-copy,
.status-card {
  border-color: rgba(157, 189, 208, 0.24);
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.1), transparent 24%),
    linear-gradient(145deg, rgba(20, 31, 42, 0.96), rgba(12, 21, 30, 0.96));
  color: #f1f8fe;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.24);
}

.demo-credentials,
.invite-preview-card,
.invite-created-card {
  border-color: rgba(146, 186, 205, 0.28);
  background: rgba(10, 29, 43, 0.32);
}

.demo-credentials code {
  color: #dcf7ff;
}

.status-card dd,
.status-card dt {
  color: #e3eef7;
}

.status-card dl div {
  border-color: rgba(151, 175, 194, 0.18);
}

.metric-card {
  background:
    radial-gradient(circle at top right, rgba(35, 120, 214, 0.12), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f5f9fc 100%);
}

.gateway-admin-item {
  border-color: #d5e3ec;
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.08), transparent 22%),
    linear-gradient(180deg, #fdfefe 0%, #f5f9fc 100%);
}

.gateway-meter-toggle {
  color: #0d6f86;
}

.gateway-meter-toggle:hover {
  color: #084f61;
}

.notification-count {
  background: linear-gradient(180deg, #23c4b4 0%, #0f9a91 100%);
  color: #fff;
}

.portal-footer {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 1020;
  padding: 0.85rem 0 calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--portal-footer-border);
  background: var(--portal-footer-background);
  backdrop-filter: blur(12px);
  color: var(--portal-footer-text);
  box-shadow: var(--portal-footer-shadow);
}

.portal-footer a {
  color: var(--portal-footer-link);
}

.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.9rem;
}

.theme-picker-form {
  margin: 0;
}

.theme-picker-card {
  appearance: none;
  cursor: pointer;
  font: inherit;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: start;
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius-card);
  padding: 1rem;
  background: linear-gradient(180deg, var(--portal-surface) 0%, var(--portal-surface-strong) 100%);
  color: var(--portal-text);
  text-align: left;
  box-shadow: var(--portal-shadow);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.theme-picker-card:hover,
.theme-picker-card:focus-visible {
  border-color: var(--portal-active-nav-border);
  transform: translateY(-1px);
}

.theme-picker-card.active {
  border-color: var(--portal-active-nav-border);
  box-shadow: 0 0 0 0.16rem color-mix(in srgb, var(--portal-blue) 16%, transparent), var(--portal-shadow);
}

.theme-picker-swatch {
  display: inline-block;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.theme-picker-swatch-light {
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.2), transparent 42%),
    linear-gradient(180deg, #f8fbfd 0%, #eef4f8 100%);
}

.theme-picker-swatch-dark {
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.18), transparent 42%),
    linear-gradient(180deg, #1a2b3a 0%, #111d28 100%);
}

.theme-picker-swatch-ld {
  background:
    linear-gradient(180deg, #005eb8 0 38%, #ffffff 38% 100%),
    linear-gradient(135deg, #58585b, #7a7a7d);
}

.theme-picker-swatch-dark-ld {
  background:
    linear-gradient(180deg, #005eb8 0 38%, #10243a 38% 100%),
    linear-gradient(135deg, #58585b, #7a7a7d);
}

html[data-portal-theme="dark-ld"] .workspace-card,
html[data-portal-theme="dark-ld"] .metric-card,
html[data-portal-theme="dark-ld"] .gateway-admin-item,
html[data-portal-theme="dark-ld"] .invite-preview-card,
html[data-portal-theme="dark-ld"] .invite-created-card,
html[data-portal-theme="dark-ld"] .portal-modal,
html[data-portal-theme="dark-ld"] .hero-copy,
html[data-portal-theme="dark-ld"] .status-card,
html[data-portal-theme="dark-ld"] .auth-card {
  background:
    radial-gradient(circle at top right, rgba(31, 143, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(13, 27, 46, 0.96) 0%, rgba(16, 36, 58, 0.98) 100%);
  border-color: var(--portal-border);
  box-shadow: 0 16px 30px rgba(2, 9, 18, 0.26);
}

html[data-portal-theme="dark-ld"] .btn-danger,
html[data-portal-theme="dark-ld"] .btn-outline-danger:hover {
  border-color: #e96d14;
  background: linear-gradient(135deg, #ff7a1a 0%, #ff943e 100%);
  color: #fff;
  box-shadow: 0 10px 20px rgba(255, 122, 26, 0.18);
}

html[data-portal-theme="dark-ld"] .btn-danger:hover,
html[data-portal-theme="dark-ld"] .btn-danger:focus,
html[data-portal-theme="dark-ld"] .btn-danger:active,
html[data-portal-theme="dark-ld"] .btn-outline-danger:hover:focus {
  border-color: #ff9a4f !important;
  background: linear-gradient(135deg, #ff8a31 0%, #ffaa5e 100%) !important;
  color: #fff !important;
}

html[data-portal-theme="dark-ld"] .portal-nav,
html[data-portal-theme="dark-ld"] .org-sidebar-panel {
  border-color: rgba(54, 96, 140, 0.32);
}

.theme-picker-copy {
  display: grid;
  gap: 0.35rem;
}

.theme-picker-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.theme-picker-title {
  font-weight: 700;
}

.theme-picker-active-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.6rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  background: var(--portal-active-nav-surface);
  color: var(--portal-active-nav-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.theme-picker-description {
  color: var(--portal-text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

html[data-bs-theme="dark"] body.portal-shell {
  background:
    linear-gradient(rgba(8, 13, 19, 0.84), rgba(8, 13, 19, 0.84)),
    radial-gradient(circle at 18% 10%, rgba(20, 184, 166, 0.18), transparent 26%),
    radial-gradient(circle at 82% 0%, rgba(35, 120, 214, 0.2), transparent 24%),
    linear-gradient(180deg, #0c141c 0%, #0e1821 22%, #111d28 22%, #111d28 100%);
}

html[data-bs-theme="dark"] .workspace-shell > .workspace-header h1,
html[data-bs-theme="dark"] .workspace-shell > .workspace-header .workspace-subtitle,
html[data-bs-theme="dark"] .workspace-shell > .workspace-header .eyebrow,
html[data-bs-theme="dark"] .hero-copy h1,
html[data-bs-theme="dark"] .auth-card h1,
html[data-bs-theme="dark"] .workspace-header h2 {
  color: #f4f9fd;
}

html[data-bs-theme="dark"] .workspace-card,
html[data-bs-theme="dark"] .metric-card,
html[data-bs-theme="dark"] .gateway-admin-item,
html[data-bs-theme="dark"] .invite-preview-card,
html[data-bs-theme="dark"] .invite-created-card,
html[data-bs-theme="dark"] .portal-modal {
  border-color: #22394b;
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(17, 29, 40, 0.96) 0%, rgba(13, 24, 35, 0.96) 100%);
  color: #e1ebf4;
}

html[data-bs-theme="dark"] .workspace-card .workspace-header .workspace-subtitle,
html[data-bs-theme="dark"] .metric-card p,
html[data-bs-theme="dark"] .gateway-admin-summary p,
html[data-bs-theme="dark"] .gateway-admin-item .empty-state,
html[data-bs-theme="dark"] .invite-list-item p,
html[data-bs-theme="dark"] .allowance-note {
  color: #9db3c6;
}

html[data-bs-theme="dark"] .workspace-meta span,
html[data-bs-theme="dark"] .org-role-badge,
html[data-bs-theme="dark"] .org-dashboard-link-icon {
  border-color: #28445a;
  background: #162838;
  color: #d4e5f5;
}

html[data-bs-theme="dark"] .workspace-meta span strong {
  color: #f4f9fd;
}

html[data-bs-theme="dark"] .gateway-admin-item h3,
html[data-bs-theme="dark"] .gateway-admin-summary h3 {
  color: #f4f9fd;
}

html[data-bs-theme="dark"] .gateway-admin-summary p {
  color: #bfd2e3;
}

html[data-bs-theme="dark"] .gateway-admin-item .workspace-meta span {
  background: #193043;
  border-color: #35566f;
  color: #e2edf6;
}

html[data-bs-theme="dark"] .btn-outline-secondary {
  border-color: #34556f;
  background: #132434;
  color: #e1ecf4;
}

html[data-bs-theme="dark"] .btn-outline-secondary:hover,
html[data-bs-theme="dark"] .btn-outline-secondary:focus {
  border-color: #446d8c;
  background: #17344d;
  color: #f5fbff;
}

html[data-bs-theme="dark"] .gateway-meter-toggle {
  color: #69d7e8;
}

html[data-bs-theme="dark"] .gateway-meter-toggle:hover {
  color: #9ce8f3;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
  border-color: #2a4458;
  background: #0f1b27;
  color: #d9e5f2;
}

html[data-bs-theme="dark"] .meter-card {
  border-color: rgba(111, 136, 160, 0.24);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.06), transparent 28%),
    linear-gradient(155deg, #203545 0%, #172633 54%, #12202b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 34px rgba(0, 0, 0, 0.32);
}

html[data-bs-theme="dark"] .meter-card h4 {
  color: #f4f8fc;
}

html[data-bs-theme="dark"] .meter-card-kicker {
  color: #8fa8be;
}

html[data-bs-theme="dark"] .meter-meta-chip {
  border-color: rgba(132, 154, 175, 0.16);
  background: rgba(9, 17, 24, 0.3);
  color: #c8d6e3;
}

html[data-bs-theme="dark"] .meter-status-good {
  background: rgba(36, 180, 91, 0.2);
  color: #aaf5c3;
}

html[data-bs-theme="dark"] .meter-status-warning {
  background: rgba(245, 158, 11, 0.22);
  color: #ffd998;
}

html[data-bs-theme="dark"] .meter-status-offline {
  background: rgba(148, 167, 186, 0.22);
  color: #e2ebf4;
}

html[data-bs-theme="dark"] .meter-status-busy {
  background: rgba(35, 120, 214, 0.22);
  color: #b6d9ff;
}

html[data-bs-theme="dark"] .meter-status-neutral {
  background: rgba(124, 150, 174, 0.22);
  color: #dde7f1;
}

html[data-bs-theme="dark"] .portal-footer {
  border-top-color: rgba(64, 92, 117, 0.44);
  background: rgba(10, 18, 25, 0.9);
  color: #8fa5b7;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.32);
}

@media (max-width: 767.98px) {
  .portal-primary-nav {
    margin: 1rem 0 0;
  }

  .portal-nav {
    padding-bottom: 0.125rem;
  }
}

.org-dashboard-shell {
  --org-sidebar-width: 14rem;
  --org-sidebar-collapsed-width: 4.5rem;
  --org-sidebar-gap: 1rem;
  display: block;
  position: relative;
  min-height: calc(100vh - 11.5rem);
}

.org-dashboard-shell.is-collapsed {
  --org-sidebar-width: var(--org-sidebar-collapsed-width);
}

.org-dashboard-sidebar {
  position: fixed;
  top: 6.7rem;
  bottom: 4.9rem;
  left: max(0.75rem, calc((100vw - min(1840px, calc(100vw - 2rem))) / 2 + clamp(0.75rem, 1.8vw, 1.5rem)));
  width: var(--org-sidebar-width);
  z-index: 1010;
}

.org-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  height: 100%;
  padding: 0.9rem 0.65rem;
}

.org-sidebar-rail,
.org-sidebar-top {
  display: grid;
}

.org-sidebar-rail {
  gap: 0.45rem;
}

.org-sidebar-top {
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(170, 193, 210, 0.38);
}

.org-sidebar-identity {
  display: grid;
  gap: 0.45rem;
}

.org-sidebar-kicker {
  margin: 0;
  color: #6b879d;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.org-sidebar-identity h2 {
  margin: 0;
  color: var(--portal-text);
  font-size: 1.15rem;
  line-height: 1.15;
}

.org-dashboard-shell.is-collapsed .org-sidebar-panel {
  padding-inline: 0.45rem;
  align-items: center;
}

.org-dashboard-shell.is-collapsed .org-sidebar-identity {
  display: none;
}

.org-dashboard-shell.is-collapsed .org-dashboard-nav,
.org-dashboard-shell.is-collapsed .org-sidebar-top,
.org-dashboard-shell.is-collapsed .org-sidebar-rail {
  justify-items: center;
}

.org-dashboard-shell.is-collapsed .org-dashboard-link {
  width: 100%;
  max-width: 3rem;
  min-height: 3.4rem;
  padding-inline: 0.35rem;
}

.org-dashboard-shell.is-collapsed .org-sidebar-toggle-icon {
  transform: rotate(180deg);
}

.org-dashboard-shell.is-collapsed .org-dashboard-link-label {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.org-dashboard-content {
  min-width: 0;
  margin-left: calc(var(--org-sidebar-width) + var(--org-sidebar-gap));
}

.org-dashboard-link-icon svg {
  width: 1rem;
  height: 1rem;
}

.org-dashboard-link {
  grid-template-columns: 2rem minmax(0, 1fr);
}

.org-dashboard-link-label {
  overflow: hidden;
  transition: opacity 0.16s ease;
}

.org-dashboard-content > .workspace-card,
.org-dashboard-content > .meter-workspace-layout,
.meter-detail-stage,
.meter-detail-secondary {
  min-width: 0;
}

.meter-card-link,
.meter-directory-item {
  color: inherit;
  text-decoration: none;
}

.meter-card-link {
  display: block;
}

.meter-card-link .meter-card {
  height: 100%;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.meter-card-link:hover .meter-card,
.meter-card-link:focus-visible .meter-card {
  border-color: color-mix(in srgb, var(--meter-accent) 42%, #8eb4ca);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 20px 38px rgba(16, 34, 50, 0.13);
}

.meter-workspace-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(16rem, 19rem) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - 11.6rem);
}

.meter-directory-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 11.6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0.5rem;
  scrollbar-width: thin;
}

.meter-directory-panel::-webkit-scrollbar {
  width: 0.55rem;
}

.meter-directory-list,
.meter-activity-list {
  display: grid;
  gap: 0.9rem;
}

.meter-directory-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  box-sizing: border-box;
  padding-right: 1.35rem;
}

.meter-directory-item {
  display: block;
  transition: transform 0.18s ease;
}

.meter-directory-card {
  min-height: 0;
  gap: 0.8rem;
  padding: 0.95rem 1rem 0.9rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.meter-directory-item .meter-status-badge {
  max-width: 9.75rem;
}

.meter-directory-item:hover .meter-directory-card,
.meter-directory-item:focus-visible .meter-directory-card,
.meter-directory-item.active .meter-directory-card {
  border-color: color-mix(in srgb, var(--meter-accent) 52%, #8eb4ca);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 18px 32px rgba(16, 34, 50, 0.12);
}

.meter-directory-item.active .meter-directory-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 0 0 1px color-mix(in srgb, var(--meter-accent) 38%, transparent),
    0 18px 32px rgba(16, 34, 50, 0.12);
}

.meter-activity-header h3 {
  margin: 0;
  color: var(--portal-text);
  font-size: 1rem;
}

.meter-activity-item p,
.meter-detail-subtitle,
.meter-activity-meta {
  margin: 0.3rem 0 0;
  color: var(--portal-text-muted);
}

.meter-detail-stage,
.meter-detail-secondary {
  display: grid;
  gap: 1.25rem;
}

.meter-detail-stage {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 11.6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
}

.meter-detail-stage-entering > :not(.org-workspace-breadcrumb) {
  opacity: 0;
  transform: translateX(2rem);
  animation: meter-detail-stage-in 860ms cubic-bezier(0.2, 0.8, 0.24, 1) 120ms forwards;
}

.org-workspace-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 1.5rem;
  color: var(--portal-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.org-workspace-breadcrumb a {
  color: #0d6f86;
  text-decoration: none;
}

.org-workspace-breadcrumb a:hover {
  color: #084f61;
  text-decoration: underline;
}

.org-workspace-breadcrumb-separator {
  color: #87a0b4;
}

.meter-detail-hero {
  --meter-accent: #7c96ae;
}

.meter-detail-hero .meter-card-kicker,
.meter-detail-hero h1,
.meter-detail-hero .meter-detail-subtitle {
  color: var(--portal-text);
}

.meter-detail-hero-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.meter-detail-hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  line-height: 0.98;
}

.meter-detail-grid,
.meter-detail-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meter-detail-facts {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}

.meter-detail-facts div {
  padding-top: 0.9rem;
  border-top: 1px solid #dce8f0;
}

.meter-detail-facts div:first-child {
  padding-top: 0;
  border-top: 0;
}

.meter-detail-facts dt {
  color: #71879c;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meter-detail-facts dd {
  margin: 0.28rem 0 0;
  color: var(--portal-text);
  font-weight: 650;
}

.meter-json-block {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid #d8e5ee;
  border-radius: 16px;
  background: #f5f9fc;
  color: #19334b;
  font-size: 0.84rem;
  line-height: 1.45;
}

.meter-json-block-compact {
  margin-top: 0.9rem;
  max-height: 16rem;
}

.meter-activity-item {
  padding-top: 1rem;
  border-top: 1px solid #dce8f0;
}

.meter-activity-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.meter-activity-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

@keyframes meter-detail-stage-in {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes meter-detail-stage-in-mobile {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


html[data-bs-theme="dark"] .org-sidebar-kicker {
  color: #8ea7bc;
}

html[data-bs-theme="dark"] .org-sidebar-identity h2 {
  color: #f4f9fd;
}

html[data-bs-theme="dark"] .org-sidebar-top {
  border-top-color: #22394b;
}

html[data-bs-theme="dark"] .meter-directory-item {
  color: inherit;
}

html[data-bs-theme="dark"] .meter-activity-header h3,
html[data-bs-theme="dark"] .meter-directory-item.active .meter-directory-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px color-mix(in srgb, var(--meter-accent) 42%, transparent),
    0 18px 32px rgba(0, 0, 0, 0.28);
}

html[data-bs-theme="dark"] .meter-directory-item:hover .meter-directory-card,
html[data-bs-theme="dark"] .meter-directory-item:focus-visible .meter-directory-card,
html[data-bs-theme="dark"] .meter-directory-item.active .meter-directory-card {
  border-color: color-mix(in srgb, var(--meter-accent) 58%, #4f8daa);
}

html[data-bs-theme="dark"] .meter-activity-header h3,
html[data-bs-theme="dark"] .meter-detail-hero .meter-card-kicker,
html[data-bs-theme="dark"] .meter-detail-hero h1,
html[data-bs-theme="dark"] .meter-detail-hero .meter-detail-subtitle,
html[data-bs-theme="dark"] .meter-detail-facts dd {
  color: #f4f9fd;
}

html[data-bs-theme="dark"] .org-workspace-breadcrumb {
  color: #b6cadb;
}

html[data-bs-theme="dark"] .org-workspace-breadcrumb a {
  color: #7fe2f0;
}

html[data-bs-theme="dark"] .org-workspace-breadcrumb a:hover {
  color: #abf0f7;
}

html[data-bs-theme="dark"] .org-workspace-breadcrumb-separator {
  color: #6f879a;
}

html[data-bs-theme="dark"] .meter-directory-header p,
html[data-bs-theme="dark"] .meter-activity-item p,
html[data-bs-theme="dark"] .meter-detail-facts dt {
  color: #9eb4c7;
}

html[data-bs-theme="dark"] .meter-detail-facts div,
html[data-bs-theme="dark"] .meter-activity-item {
  border-color: #22394b;
}

html[data-bs-theme="dark"] .meter-json-block {
  border-color: #274154;
  background: #0d1721;
  color: #dce8f2;
}

html[data-bs-theme="dark"] .gateway-location-meta span {
  border-color: rgba(132, 154, 175, 0.16);
  background: rgba(9, 17, 24, 0.3);
  color: #c8d6e3;
}

html[data-bs-theme="dark"] .gateway-location-more-trigger {
  border-color: rgba(132, 154, 175, 0.28);
  color: #b9cedf;
}

html[data-bs-theme="dark"] .gateway-location-more-panel {
  border-color: #274154;
  background: rgba(13, 23, 33, 0.98);
  color: #dce8f2;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.32);
}

html[data-bs-theme="dark"] .gateway-location-map-shell {
  border-color: #274154;
  background: #0d1721;
}

html[data-bs-theme="dark"] .meter-telemetry-stat,
html[data-bs-theme="dark"] .meter-telemetry-chart-card {
  border-color: #274154;
  background: rgba(13, 23, 33, 0.92);
}

html[data-bs-theme="dark"] .meter-telemetry-stat dt,
html[data-bs-theme="dark"] .meter-telemetry-chart-header span,
html[data-bs-theme="dark"] .meter-telemetry-chart-labels {
  color: #9eb4c7;
}

html[data-bs-theme="dark"] .meter-telemetry-stat dd,
html[data-bs-theme="dark"] .meter-telemetry-chart-header h3 {
  color: #f4f9fd;
}

html[data-bs-theme="dark"] .meter-telemetry-chart-shell {
  background: linear-gradient(180deg, rgba(17, 29, 40, 0.96) 0%, rgba(13, 24, 35, 0.96) 100%);
}

html[data-bs-theme="dark"] .meter-telemetry-chart-line {
  stroke: #7fe2f0;
}

html[data-portal-theme="dark-ld"] .org-card,
html[data-portal-theme="dark-ld"] .workspace-card,
html[data-portal-theme="dark-ld"] .metric-card,
html[data-portal-theme="dark-ld"] .gateway-admin-item,
html[data-portal-theme="dark-ld"] .invite-preview-card,
html[data-portal-theme="dark-ld"] .invite-created-card,
html[data-portal-theme="dark-ld"] .portal-modal,
html[data-portal-theme="dark-ld"] .hero-copy,
html[data-portal-theme="dark-ld"] .status-card,
html[data-portal-theme="dark-ld"] .auth-card,
html[data-portal-theme="dark-ld"] .meter-card,
html[data-portal-theme="dark-ld"] .meter-directory-card {
  border-color: var(--portal-border);
  background:
    radial-gradient(circle at top right, rgba(31, 143, 255, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(13, 27, 46, 0.96) 0%, rgba(16, 36, 58, 0.98) 100%);
  box-shadow: 0 16px 30px rgba(2, 9, 18, 0.26);
}

html[data-portal-theme="dark-ld"] .org-card {
  color: var(--portal-org-card-text);
}

html[data-portal-theme="dark-ld"] .org-card p,
html[data-portal-theme="dark-ld"] .org-card .workspace-meta span,
html[data-portal-theme="dark-ld"] .meter-card-kicker {
  color: #aebfd0;
}

html[data-portal-theme="dark-ld"] .meter-card h4,
html[data-portal-theme="dark-ld"] .org-card h2 {
  color: #f4f8fc;
}

@media (max-width: 1150px) {
  .meter-workspace-layout,
  .meter-detail-grid,
  .meter-detail-secondary,
  .gateway-location-panel,
  .meter-location-layout {
    grid-template-columns: 1fr;
  }

  .meter-telemetry-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meter-directory-panel {
    position: static;
  }
}

@media (max-width: 1150px) {
  .portal-nav-shell,
  .portal-content-shell,
  .portal-footer-shell {
    max-width: calc(100vw - 1rem);
    padding-inline: 0.5rem;
  }

  .portal-content-shell {
    padding-bottom: 5.75rem;
  }

  .org-dashboard-shell,
  .org-dashboard-shell.is-collapsed {
    min-height: 0;
  }

  .org-dashboard-sidebar {
    position: fixed;
    inset: 6.05rem 0.5rem auto 0.5rem;
    width: auto;
    z-index: 1015;
  }

  .org-sidebar-panel {
    min-height: 0;
    padding: 0.45rem 0.55rem;
    width: 100%;
    border-radius: 18px;
  }

  .org-sidebar-toggle,
  .org-sidebar-top {
    display: none;
  }

  .org-sidebar-rail {
    gap: 0;
    width: 100%;
  }

  .org-dashboard-nav {
    width: 100%;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch;
    gap: 0.35rem;
    justify-items: stretch;
  }

  .org-dashboard-link,
  .org-dashboard-shell.is-collapsed .org-dashboard-link {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.35rem;
    width: 100%;
    max-width: none;
    min-height: 3.55rem;
    padding: 0.55rem 0.25rem 0.45rem;
  }

  .org-dashboard-link-label,
  .org-dashboard-shell.is-collapsed .org-dashboard-link-label {
    display: none;
    width: 0;
    opacity: 0;
  }

  .org-dashboard-link-icon {
    width: 2.15rem;
    height: 2.15rem;
  }

  .org-dashboard-content {
    margin-left: 0;
    padding-top: 4.65rem;
    padding-bottom: 0.5rem;
  }

  .org-dashboard-shell.is-collapsed .org-sidebar-top,
  .org-dashboard-shell.is-collapsed .org-dashboard-nav {
    justify-items: stretch;
  }

  .meter-directory-panel {
    display: none;
  }

  .meter-workspace-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .meter-detail-stage {
    gap: 1rem;
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .meter-directory-list {
    overflow: visible;
    padding-right: 0;
  }

  .meter-detail-stage-entering > :not(.org-workspace-breadcrumb) {
    transform: translateY(1rem);
    animation-name: meter-detail-stage-in-mobile;
    animation-duration: 480ms;
    animation-delay: 40ms;
  }

  .meter-telemetry-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .meter-directory-header,
  .meter-detail-hero-top,
  .meter-activity-header {
    flex-direction: column;
  }

  .meter-directory-header .meter-status-badge,
  .meter-detail-hero-top .meter-card-status {
    align-items: start;
    justify-items: start;
  }
}
