@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat/Montserrat-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat/Montserrat-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat/Montserrat-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat/Montserrat-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Material Symbols Outlined";
  src: url("../fonts/materialsymbols/MaterialSymbolsOutlined.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

:root {
  --loxal-red: #ed1c24;
  --loxal-dark-grey: #231f20;
  --loxal-white: #ffffff;
  --loxal-black: #000000;
  --shell-max-width: 1400px;
  --radius-tight: 0.3rem;
  --radius-control: 0.45rem;
  --radius-surface: 0.5rem;
  --surface-padding: 1.16rem;
  --card-padding: 1.02rem;
  --surface-padding-mobile: 1.04rem;
  --card-padding-mobile: 1.04rem;
  --sidebar-width: 15.5rem;
  --top-shell-height: 4.75rem;
}

html {
  font-size: 16px;
  min-height: 100%;
}

html[data-theme="light"] {
  color-scheme: light;
  --page-bg: #f4f2f1;
  --page-gradient-start: #ffffff;
  --page-gradient-mid: #f6f3f3;
  --page-gradient-end: #ebe7e6;
  --surface-raised: rgba(255, 255, 255, 0.92);
  --surface-secondary: rgba(255, 255, 255, 0.82);
  --surface-muted: rgba(35, 31, 32, 0.03);
  --surface-tint: rgba(237, 28, 36, 0.08);
  --border-soft: rgba(35, 31, 32, 0.08);
  --border-strong: rgba(35, 31, 32, 0.16);
  --text-primary: #231f20;
  --text-secondary: #5d5557;
  --text-muted: #756d70;
  --text-on-dark: #ffffff;
  --hero-start: #ffffff;
  --hero-end: #f2ecec;
  --field-bg: #ffffff;
  --table-stripe: rgba(35, 31, 32, 0.025);
  --toggle-bg: rgba(255, 255, 255, 0.86);
  --shadow-sm: 0 10px 24px rgba(35, 31, 32, 0.06);
  --shadow-lg: 0 18px 48px rgba(35, 31, 32, 0.08);
  --focus-ring: rgba(237, 28, 36, 0.24);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #231f20;
  --page-gradient-start: #2f2a2c;
  --page-gradient-mid: #231f20;
  --page-gradient-end: #1a1718;
  --surface-raised: rgba(44, 39, 40, 0.92);
  --surface-secondary: rgba(54, 48, 49, 0.84);
  --surface-muted: rgba(255, 255, 255, 0.04);
  --surface-tint: rgba(237, 28, 36, 0.14);
  --border-soft: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-primary: #f5f2f2;
  --text-secondary: #d5cdcf;
  --text-muted: #afa4a7;
  --text-on-dark: #ffffff;
  --hero-start: #2b2628;
  --hero-end: #1e1a1b;
  --field-bg: rgba(17, 14, 15, 0.46);
  --table-stripe: rgba(255, 255, 255, 0.03);
  --toggle-bg: rgba(44, 39, 40, 0.9);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 22px 56px rgba(0, 0, 0, 0.28);
  --focus-ring: rgba(237, 28, 36, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--text-primary);
  background:
    radial-gradient(circle 36rem at top right, rgba(237, 28, 36, 0.08), transparent 100%),
    radial-gradient(circle 38rem at bottom left, rgba(35, 31, 32, 0.08), transparent 100%),
    linear-gradient(180deg, var(--page-gradient-start) 0%, var(--page-gradient-mid) 52%, var(--page-gradient-end) 100%);
  transition: background-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

.material-symbols-outlined,
.ms {
  direction: ltr;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Material Symbols Outlined";
  font-feature-settings: "liga";
  font-size: 1.22rem;
  font-style: normal;
  font-weight: normal;
  letter-spacing: normal;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
}

html:not(.material-icons-ready) .material-symbols-outlined,
html:not(.material-icons-ready) .ms {
  color: transparent !important;
}

.ms-sm {
  font-size: 1rem;
}

a {
  color: var(--loxal-red);
  text-decoration: none;
  transition: color 0.16s ease;
}

a:hover {
  color: #c6161d;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.18;
}

.display-6 {
  font-size: 1.62rem;
  font-weight: 600;
}

.h3,
h3 {
  font-size: 1.34rem;
}

.h4,
h4 {
  font-size: 1.08rem;
}

.h5,
h5 {
  font-size: 0.98rem;
}

.container-xl {
  max-width: var(--shell-max-width);
}

html[data-theme="light"] .theme-asset-dark,
.theme-asset-dark {
  display: none !important;
}

html[data-theme="light"] .theme-asset-light {
  display: block !important;
}

html[data-theme="dark"] .theme-asset-light {
  display: none !important;
}

html[data-theme="dark"] .theme-asset-dark {
  display: block !important;
}

.login-banner .login-brandmark.theme-asset-light {
  display: none !important;
}

.login-banner .login-brandmark.theme-asset-dark {
  display: block !important;
}

.portal-body-auth .shell-content {
  padding-top: 5.5rem;
}

.skip-link {
  position: fixed;
  top: 0;
  left: 1rem;
  z-index: 1050;
  padding: 0.7rem 1rem;
  color: var(--text-on-dark);
  background: var(--loxal-dark-grey);
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  box-shadow: var(--shadow-sm);
  transform: translateY(calc(-100% - 1rem));
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.btn,
.form-control,
.form-select,
.form-check-input,
.accordion-button,
.nav-link,
.shell-utility-link,
.theme-toggle,
.card-link-shell .feature-card {
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.accordion-button:focus,
.theme-toggle:focus {
  box-shadow: 0 0 0 0.12rem rgba(255, 255, 255, 0.2), 0 0 0 0.3rem var(--focus-ring);
}

.btn {
  border-radius: var(--radius-control);
  padding: 0.54rem 0.82rem;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-primary {
  color: var(--loxal-white);
  background-color: var(--loxal-red);
  border-color: var(--loxal-red);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  color: var(--loxal-white);
  background-color: #cf171e;
  border-color: #cf171e;
}

.btn-outline-primary {
  color: var(--text-primary);
  border-color: rgba(237, 28, 36, 0.36);
  background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  color: var(--text-primary);
  border-color: rgba(237, 28, 36, 0.56);
  background: var(--surface-tint);
}

.btn-close {
  opacity: 0.75;
}

html[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(1);
}

.top-shell {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1020;
  height: var(--top-shell-height);
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  backdrop-filter: blur(18px);
}

.navbar {
  padding-block: 1rem;
  gap: 1rem;
}

.brand-link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.42rem;
  min-height: var(--top-shell-height);
  padding-block: 0.7rem;
  margin-right: 1.75rem;
  white-space: normal;
}

.brand-link:hover {
  color: inherit;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
}

.brand-wordmark-image {
  height: 1.45rem;
  width: auto;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.brand-product {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-tagline {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.navbar-nav {
  gap: 0.25rem;
}

.nav-link {
  color: var(--text-secondary);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-control);
  font-weight: 600;
  white-space: nowrap;
}

.nav-link.active,
.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-tint);
}

.shell-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.tenant-shell-control {
  min-width: min(100%, 22rem);
}

.tenant-switcher-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap;
}

.tenant-switcher-label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tenant-switcher-form .form-select {
  min-width: 14rem;
  max-width: 20rem;
  padding: 0.5rem 2rem 0.5rem 0.85rem;
  border-color: var(--border-strong);
  border-radius: var(--radius-control);
  background-color: var(--field-bg);
}

.shell-utility-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.shell-utility-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  background: var(--surface-secondary);
  font-size: 0.92rem;
  font-weight: 600;
}

.shell-utility-link:hover,
.shell-utility-link.active {
  color: var(--text-primary);
  border-color: rgba(237, 28, 36, 0.22);
  background: var(--surface-tint);
}

.shell-account-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  min-width: min(100%, 14rem);
  padding: 0.48rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface-tint) 18%);
  box-shadow: var(--shadow-sm);
}

.shell-account-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--text-primary);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 600;
}

.shell-account-action:hover,
.shell-account-action.active {
  color: var(--loxal-red);
  background: var(--surface-raised);
}

.shell-account-logout {
  width: 100%;
}

.shell-account-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-control);
  color: inherit;
}

.shell-account-summary:hover,
.shell-account-summary.active {
  color: inherit;
  background: var(--surface-raised);
}

.shell-account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.72rem;
  height: 1.72rem;
  border-radius: 50%;
  background: #22c7a9;
  color: #082b26;
  font-size: 0.82rem;
  font-weight: 800;
}

.shell-account-copy {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.shell-account-name,
.shell-account-subaccount {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-account-name {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.shell-account-subaccount {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.user-chip,
.tenant-chip,
.hero-chip,
.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.46rem 0.72rem;
  border-radius: var(--radius-surface);
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface-tint) 18%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.user-chip {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.tenant-chip {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
}

.tenant-chip-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tenant-chip-name {
  max-width: 13rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-toggle-floating {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1045;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.58rem 0.92rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--toggle-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(237, 28, 36, 0.34);
}

.theme-toggle-icon {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  opacity: 0.92;
}

.shell-content {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.hero-panel,
.content-panel,
.feature-card,
.workflow-card,
.login-shell,
.login-card,
.table-shell,
.form-shell,
.accordion-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.hero-panel,
.content-panel,
.login-shell,
.table-shell,
.form-shell {
  padding: var(--surface-padding);
}

.feature-card,
.workflow-card,
.login-card {
  padding: var(--card-padding);
}

.hero-panel,
.login-banner {
  position: relative;
  overflow: hidden;
}

.hero-panel::before,
.login-banner::before {
  content: "";
  position: absolute;
  inset: auto -14% -28% auto;
  width: 15rem;
  height: 15rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(237, 28, 36, 0.16), transparent 70%);
  pointer-events: none;
}

.hero-panel {
  background: linear-gradient(145deg, var(--hero-start), var(--hero-end));
}

.hero-panel-compact {
  padding: 0.95rem 1.15rem;
}

.customer-users-hero,
.customer-groups-hero {
  z-index: 30;
  overflow: visible;
}

.customer-users-hero::before,
.customer-groups-hero::before {
  display: none;
}

.customer-tenants-hero {
  z-index: 30;
  overflow: visible;
}

.customer-tenants-hero::before {
  display: none;
}

.customer-audits-hero {
  z-index: 30;
  overflow: visible;
}

.customer-audits-hero::before {
  display: none;
}

.customer-locks-hero {
  z-index: 30;
  overflow: visible;
}

.customer-locks-hero::before {
  display: none;
}

.customer-app-access-hero {
  z-index: 30;
  overflow: visible;
}

.customer-app-access-hero::before {
  display: none;
}

.global-admin-tools-hero,
.global-admin-locks-hero,
.global-admin-users-hero,
.global-admin-tenants-hero,
.global-admin-app-access-hero {
  z-index: 30;
  overflow: visible;
}

.global-admin-tools-hero::before,
.global-admin-locks-hero::before,
.global-admin-users-hero::before,
.global-admin-tenants-hero::before,
.global-admin-app-access-hero::before {
  display: none;
}

.hero-copy {
  max-width: 44rem;
}

.hero-brandmark {
  align-self: stretch;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: min(14rem, 100%);
}

.hero-brandmark img {
  width: min(13rem, 40vw);
  border-radius: var(--radius-surface);
  box-shadow: var(--shadow-sm);
}

.feature-card {
  color: inherit;
}

.feature-card-action {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.7rem;
  min-height: 10.2rem;
}

.feature-card-action h2,
.feature-card-action p {
  margin: 0;
}

.feature-card-action p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.45;
}

.home-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--loxal-red);
  font-size: 2.35rem;
}

.home-info-panel {
  display: block;
}

.home-info-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.home-info-summary::-webkit-details-marker {
  display: none;
}

.home-info-panel[open] .collapsible-workflow-toggle {
  transform: rotate(225deg);
}

.home-info-body {
  padding-top: 1rem;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 52px rgba(35, 31, 32, 0.12);
}

html[data-theme="dark"] .feature-card:hover {
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.32);
}

.workflow-card {
  background: linear-gradient(180deg, var(--surface-raised), color-mix(in srgb, var(--surface-raised) 78%, var(--surface-muted) 22%));
}

.workflow-grid {
  display: grid;
  gap: 1rem;
}

.collapsible-workflow {
  display: block;
}

.collapsible-workflow-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.collapsible-workflow-summary::-webkit-details-marker {
  display: none;
}

.collapsible-workflow-toggle {
  width: 0.72rem;
  height: 0.72rem;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.collapsible-workflow[open] .collapsible-workflow-toggle {
  transform: rotate(225deg);
}

.collapsible-workflow-body {
  padding-top: 1rem;
}

.table-summary-disclosure {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--surface-raised) 84%, var(--surface-muted) 16%);
}

.table-summary-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  list-style: none;
  text-transform: uppercase;
}

.table-summary-disclosure > summary::-webkit-details-marker {
  display: none;
}

.table-summary-disclosure[open] > summary .collapsible-workflow-toggle {
  transform: rotate(225deg);
}

.table-summary-disclosure .unit-type-count-list {
  padding: 0 0.8rem 0.55rem;
}

.bulk-activation-options {
  padding: 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--surface-raised) 88%, var(--surface-tint) 12%);
}

.data-grid-section {
  min-width: 0;
}

.user-command-panel {
  position: relative;
}

.customer-user-command-panel:not([open]) {
  display: none;
}

.customer-user-command-panel > .user-action-summary,
.customer-user-register > .collapsible-workflow-summary,
.global-admin-user-register > .collapsible-workflow-summary,
.global-admin-lock-register > .collapsible-workflow-summary {
  display: none;
}

.global-admin-user-register > .collapsible-workflow-body,
.global-admin-lock-register > .collapsible-workflow-body {
  padding-top: 0;
}

.global-admin-users-layout,
.global-admin-locks-layout {
  display: flex;
  flex-direction: column;
}

.global-admin-users-hero,
.global-admin-locks-hero {
  order: 0;
}

.global-admin-users-feedback {
  order: 1;
}

.global-admin-user-register,
.global-admin-lock-register {
  order: 2;
}

.global-admin-user-command-panel,
.global-admin-lock-workflow {
  order: 3;
}

.global-admin-tools-grid .global-admin-user-register {
  order: -1;
  grid-column: 1 / -1;
}

.customer-user-command-panel .workflow-drawer-panel {
  border-top: 0;
}

.user-action-summary-copy {
  flex: 1 1 18rem;
  min-width: 12rem;
}

.user-action-summary-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  min-width: 0;
}

.user-action-summary-controls .user-workflow-actions {
  flex: 1 1 auto;
}

.user-search-form {
  min-width: 0;
}

.user-filter-actions-col {
  align-self: end;
}

.filter-button-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  min-width: min(100%, 17rem);
}

.filter-button-pair .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  width: 100%;
  white-space: nowrap;
}

.user-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  align-self: start;
}

.user-workflow-actions .btn {
  white-space: nowrap;
}

.codes-filter-form {
  width: 100%;
}

.codes-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.codes-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.codes-workflow-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.75rem;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--loxal-red);
  background: color-mix(in srgb, var(--surface-raised) 84%, var(--surface-tint) 16%);
}

.codes-action-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.codes-action-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 1rem;
}

.codes-action-group + .codes-action-group {
  border-left: 1px solid var(--border-soft);
}

.codes-action-buttons {
  align-self: stretch;
  justify-content: flex-start;
  max-width: none;
}

.codes-action-buttons .btn {
  flex: 1 1 13rem;
}

.user-workflow-actions .btn.active,
.user-workflow-actions .btn[aria-expanded="true"] {
  color: var(--btn-primary-color);
  border-color: var(--loxal-red);
  background: var(--loxal-red);
}

.workflow-drawer {
  overflow-anchor: none;
}

.workflow-drawer-panel {
  border-top: 1px solid var(--border-soft);
}

.workflow-drawer-inner {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
}

.workflow-drawer-heading {
  max-width: 44rem;
}

.workflow-drawer-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.workflow-drawer-section {
  min-width: 0;
}

.workflow-drawer-section + .workflow-drawer-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}

.workflow-card-tint,
.feature-card-muted {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 74%, var(--surface-tint) 26%), var(--surface-raised));
}

.card-link-shell {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.card-link-shell:hover,
.card-link-shell:focus-visible,
.card-link-shell:active {
  color: inherit;
  text-decoration: none;
}

.card-link-shell:focus-visible {
  outline: 2px solid var(--loxal-red);
  outline-offset: 4px;
  border-radius: var(--radius-surface);
}

.eyebrow {
  color: var(--loxal-red);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cta-link {
  color: var(--text-primary);
  font-weight: 700;
}

.cta-link::after {
  content: " ->";
  color: var(--loxal-red);
}

.footer-shell {
  padding: 1rem 0 2rem;
}

.footer-shell.app-footer-shell {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: var(--shell-max-width);
  margin: auto auto 0 0;
  padding: 0.5rem 1.5rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.footer-shell .container-xl {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 0.94rem;
}

.footer-product {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: baseline;
  font-weight: 600;
}

.footer-version {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.app-footer-left,
.app-footer-right {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
}

.app-footer-right {
  justify-content: flex-end;
}

.app-footer-shell .footer-item + .footer-item::before {
  content: "|";
  color: var(--border-strong);
  margin: 0 0.55rem;
}

.footer-shell-auth .container-xl {
  justify-content: center;
  text-align: center;
}

.login-shell {
  overflow: hidden;
}

.login-banner {
  height: 100%;
  padding: 1.8rem;
  border-radius: var(--radius-surface);
  background:
    linear-gradient(165deg, rgba(35, 31, 32, 0.98), rgba(56, 48, 49, 0.98)),
    linear-gradient(165deg, rgba(237, 28, 36, 0.12), transparent);
  color: var(--text-on-dark);
}

.login-identity {
  display: inline-flex;
  align-items: center;
}

.login-brandmark {
  height: 1.55rem;
  width: auto;
}

.login-product-mark img {
  width: min(13rem, 42vw);
  border-radius: var(--radius-surface);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

.privacy-shell {
  display: grid;
  gap: 1.4rem;
  max-width: 920px;
  margin: 0 auto;
}

.privacy-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
}

.privacy-brand > img:not(.privacy-product-mark) {
  width: min(10rem, 42vw);
  height: auto;
}

.privacy-product-mark {
  width: min(10rem, 36vw);
  height: auto;
  border-radius: var(--radius-surface);
  box-shadow: var(--shadow-sm);
}

.privacy-panel {
  padding: clamp(1.3rem, 3vw, 2.4rem);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.privacy-panel .lead {
  color: var(--text-secondary);
  line-height: 1.75;
}

.privacy-panel h2 {
  margin-top: 1.65rem;
  margin-bottom: 0.55rem;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.privacy-panel p {
  color: var(--text-secondary);
  line-height: 1.72;
}

.accordion {
  --bs-accordion-border-radius: var(--radius-surface);
  --bs-accordion-inner-border-radius: var(--radius-surface);
}

.accordion-item {
  overflow: hidden;
}

.accordion-item,
.accordion-item:first-of-type,
.accordion-item:last-of-type,
.accordion-item:first-of-type > .accordion-header .accordion-button,
.accordion-item:last-of-type > .accordion-header .accordion-button.collapsed {
  border-radius: var(--radius-surface);
}

.accordion-button {
  font-weight: 700;
  border-radius: 0;
  color: var(--text-primary);
  background: transparent;
}

.accordion-button:not(.collapsed) {
  color: var(--text-primary);
  background: var(--surface-tint);
}

.accordion-button::after {
  filter: saturate(0);
}

html[data-theme="dark"] .accordion-button::after {
  filter: invert(1) saturate(0);
}

.table-shell .table,
.content-panel .table,
.form-shell .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: var(--border-soft);
  --bs-table-striped-bg: var(--table-stripe);
  --bs-table-striped-color: var(--text-primary);
  margin-bottom: 0;
}

.table thead th {
  border-bottom-width: 1px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.portal-section-units .table-shell .table,
body.portal-section-assigned-units .table-shell .table,
body.portal-section-users .table-shell .table,
body.portal-section-tenants .table-shell .table,
body.portal-section-codes .table-shell .table,
body.portal-section-groups .table-shell .table,
body.portal-section-audits .table-shell .table {
  font-size: 0.78rem;
}

body.portal-section-units .table-shell .table thead th,
body.portal-section-assigned-units .table-shell .table thead th,
body.portal-section-users .table-shell .table thead th,
body.portal-section-tenants .table-shell .table thead th,
body.portal-section-codes .table-shell .table thead th,
body.portal-section-groups .table-shell .table thead th,
body.portal-section-audits .table-shell .table thead th {
  font-size: 0.64rem;
}

body.portal-section-units .table-shell .btn-sm,
body.portal-section-assigned-units .table-shell .btn-sm,
body.portal-section-users .table-shell .btn-sm,
body.portal-section-tenants .table-shell .btn-sm,
body.portal-section-codes .table-shell .btn-sm,
body.portal-section-groups .table-shell .btn-sm,
body.portal-section-audits .table-shell .btn-sm {
  --bs-btn-font-size: 0.72rem;
}

.portal-action-table {
  --portal-action-column-width: 9rem;
  width: 100%;
  min-width: 48rem;
}

.portal-action-table-compact {
  --portal-action-column-width: 7.5rem;
  min-width: 42rem;
}

.portal-action-table-medium {
  --portal-action-column-width: 11.5rem;
  min-width: 52rem;
}

.portal-action-table-wide {
  --portal-action-column-width: 15rem;
  min-width: 68rem;
}

.portal-action-cell {
  position: sticky;
  right: 0;
  z-index: 1;
  width: var(--portal-action-column-width);
  min-width: var(--portal-action-column-width);
  padding-left: 1rem;
  border-left: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-raised) 97%, var(--page-bg) 3%);
  box-shadow: -0.45rem 0 0.75rem rgba(0, 0, 0, 0.06);
}

.portal-action-table thead .portal-action-cell {
  z-index: 2;
}

.portal-action-cell .btn,
.portal-action-cell .metric-badge {
  white-space: nowrap;
}

.user-admin-table {
  --portal-action-column-width: 19rem;
  width: 100%;
  min-width: 64rem;
  table-layout: fixed;
}

.user-admin-table .user-email-cell {
  width: 13%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-admin-table .user-company-cell {
  width: 10%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.user-admin-table .user-table-actions {
  align-items: center;
  gap: 0.5rem;
}

.user-admin-table .user-table-actions .btn,
.user-admin-table .user-table-actions .metric-badge {
  white-space: nowrap;
}

.portal-data-grid .portal-grid-group-row > th {
  background: var(--surface-muted);
  color: var(--text-primary);
  font-weight: 600;
  border-top: 1px solid var(--border-strong);
}

.portal-grid-toolbar {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(10rem, 0.35fr) auto;
  gap: 0.65rem;
  align-items: end;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-soft);
}

.portal-grid-search,
.portal-grid-filter {
  min-width: 0;
}

.portal-grid-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.portal-grid-toolbar-actions .btn {
  white-space: nowrap;
}

.mobile-access-grid-toolbar {
  grid-template-columns: minmax(14rem, 1fr) auto;
  align-items: center;
}

.portal-data-grid td {
  padding: 0.5rem 0.6rem;
}

.portal-sort-header {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 1.75rem;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.portal-sort-header:hover,
.portal-sort-header:focus {
  color: var(--text-primary);
}

.portal-sort-indicator {
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 0.75rem;
  opacity: 0.55;
  font-size: 0.78rem;
  line-height: 1;
}

.portal-sort-indicator::before {
  content: "\2195";
}

.portal-sort-header[aria-sort="ascending"] .portal-sort-indicator {
  opacity: 1;
}

.portal-sort-header[aria-sort="ascending"] .portal-sort-indicator::before {
  content: "\2191";
}

.portal-sort-header[aria-sort="descending"] .portal-sort-indicator {
  opacity: 1;
}

.portal-sort-header[aria-sort="descending"] .portal-sort-indicator::before {
  content: "\2193";
}

.grid-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-soft);
}

.grid-pagination[hidden] {
  display: none;
}

.grid-pagination-status {
  min-width: 10rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: center;
}

.unit-grid-toolbar {
  display: grid;
  grid-template-columns: minmax(12rem, 1.2fr) minmax(0, 4fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--border-soft);
}

.unit-grid-table td {
  padding: 0.5rem 0.6rem;
}

.unit-grid-table {
  font-size: 0.78rem;
}

.unit-grid-table thead th {
  font-size: 0.64rem;
}

.unit-grid-search,
.unit-grid-filters {
  min-width: 0;
}

.unit-grid-search .form-control,
.unit-filter-select,
.unit-filter-menu-toggle {
  min-height: 2.34rem;
  font-size: 0.82rem;
}

.unit-grid-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.unit-filter-select,
.unit-filter-menu {
  width: min(100%, 10.75rem);
}

.unit-filter-menu {
  position: relative;
}

.unit-filter-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  padding: 0.52rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  color: var(--text-primary);
  background: var(--field-bg);
  cursor: pointer;
  list-style: none;
}

.unit-filter-menu-toggle::-webkit-details-marker {
  display: none;
}

.unit-filter-menu-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-filter-menu-toggle::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.unit-filter-menu[open] .unit-filter-menu-toggle::after {
  transform: rotate(225deg);
}

.unit-filter-menu-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  display: grid;
  gap: 0.2rem;
  width: min(22rem, 82vw);
  max-height: min(24rem, 60vh);
  overflow: auto;
  padding: 0.45rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.unit-filter-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
  padding: 0.42rem 0.5rem;
  border-radius: var(--radius-tight);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
  text-transform: none;
}

.unit-filter-option:hover,
.unit-filter-option:has(.form-check-input:checked) {
  background: color-mix(in srgb, var(--surface-raised) 78%, var(--surface-tint) 22%);
}

.unit-filter-option-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.unit-export-button {
  min-height: 2.34rem;
  white-space: nowrap;
}

.unit-sort-header {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 1.85rem;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
}

.unit-sort-header:hover,
.unit-sort-header:focus {
  color: var(--text-primary);
}

.unit-sort-indicator {
  display: inline-flex;
  flex: 0 0 auto;
  width: 0.48rem;
  height: 0.48rem;
  opacity: 0.48;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.unit-sort-header[aria-sort="ascending"] .unit-sort-indicator {
  opacity: 1;
  transform: rotate(225deg);
}

.unit-sort-header[aria-sort="descending"] .unit-sort-indicator {
  opacity: 1;
  transform: rotate(45deg);
}

.table td {
  vertical-align: middle;
  padding: 0.62rem 0.7rem;
}

.form-label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

.requiredmark {
  color: var(--loxal-red);
  font-weight: 700;
  margin-left: 0.24rem;
}

.form-control,
.form-select {
  border-radius: var(--radius-control);
  border: 1px solid var(--border-soft);
  background: var(--field-bg);
  color: var(--text-primary);
  min-height: 2.36rem;
  padding: 0.56rem 0.72rem;
  font-size: 0.86rem;
  line-height: 1.35;
}

.form-select {
  cursor: pointer;
  border-color: var(--border-strong);
  padding-right: 2.5rem;
  background-color: color-mix(in srgb, var(--field-bg) 86%, var(--surface-tint) 14%);
  background-image:
    linear-gradient(90deg, transparent calc(100% - 2.1rem), var(--surface-tint) calc(100% - 2.1rem)),
    url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ed1c24' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right center, right 0.72rem center;
  background-size: auto, 0.74rem 0.74rem;
}

.form-select:hover {
  border-color: rgba(237, 28, 36, 0.42);
  background-color: color-mix(in srgb, var(--field-bg) 78%, var(--surface-tint) 22%);
}

.form-control::placeholder,
.form-select::placeholder {
  color: var(--text-muted);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(237, 28, 36, 0.44);
  background: var(--field-bg);
  color: var(--text-primary);
}

.form-select:focus {
  background-color: color-mix(in srgb, var(--field-bg) 80%, var(--surface-tint) 20%);
  background-image:
    linear-gradient(90deg, transparent calc(100% - 2.1rem), var(--surface-tint) calc(100% - 2.1rem)),
    url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ed1c24' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 6 5 5 5-5'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right center, right 0.72rem center;
  background-size: auto, 0.74rem 0.74rem;
}

.form-check-input {
  border-color: var(--border-strong);
  background-color: var(--field-bg);
}

.form-check-input:checked {
  background-color: var(--loxal-red);
  border-color: var(--loxal-red);
}

.transfer-tenant-select {
  width: min(11rem, 45vw);
  min-height: 2rem;
  padding: 0.34rem 2rem 0.34rem 0.58rem;
  border-radius: var(--radius-control);
}

.unit-grid-action-table {
  min-width: 78rem;
}

.unit-grid-action-table-wide {
  --portal-action-column-width: 8.5rem;
  min-width: 78rem;
}

.unit-actions-cell {
  padding-right: 0.75rem;
}

.unit-row-action {
  display: inline-flex;
  justify-content: flex-end;
  width: 100%;
}

.unit-row-action-trigger,
.unit-row-action-close {
  padding: 0;
  border: 0;
  color: var(--text-primary);
  background: transparent;
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2rem;
}

.unit-row-action-trigger:hover,
.unit-row-action-trigger:focus-visible,
.unit-row-action-close:hover,
.unit-row-action-close:focus-visible {
  color: var(--loxal-red);
}

.unit-row-action-popover {
  position: fixed;
  inset: auto;
  display: none;
  gap: 0.65rem;
  width: min(20rem, calc(100vw - 1.5rem));
  max-height: min(32rem, calc(100vh - 1.5rem));
  margin: 0;
  padding: 0.75rem;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-surface);
  color: var(--text-primary);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.unit-row-action-popover:popover-open,
.unit-row-action-popover[data-fallback-open="true"] {
  display: grid;
}

.unit-row-action-popover::backdrop {
  background: transparent;
}

.unit-row-action-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-soft);
}

.unit-row-action-close {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.unit-row-transfer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(4rem, auto);
  gap: 0.45rem;
  align-items: center;
}

.unit-row-transfer .transfer-tenant-select {
  width: 100%;
}

.unit-row-transfer .btn,
.unit-row-action-buttons .btn {
  white-space: nowrap;
}

.unit-row-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
  align-items: center;
}

.unit-row-action-buttons .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding-right: 0.45rem;
  padding-left: 0.45rem;
  text-overflow: ellipsis;
}

.unit-row-action-buttons .btn-primary {
  min-width: 0;
}

.password-reset-link-alert {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border-soft));
}

.password-reset-link-output {
  max-width: min(100%, 44rem);
}

.unit-code-modal {
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.unit-code-modal .modal-header,
.unit-code-modal .modal-footer {
  border-color: var(--border-soft);
}

.unit-map-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: color-mix(in srgb, var(--surface-raised) 82%, var(--surface-muted) 18%);
}

.unit-readonly-value {
  display: flex;
  align-items: center;
  min-height: 2.35rem;
  color: var(--text-primary);
  background: var(--field-bg);
}

.unit-edit-data-column,
.unit-edit-data-column + .unit-edit-notes-column {
  margin-top: 0.75rem;
}

.unit-edit-data-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--bs-gutter-x, 1.5rem);
  row-gap: 0;
  padding: 0;
}

.unit-edit-data-item {
  min-width: 0;
  padding: 0;
}

.unit-edit-info-grid,
.unit-edit-advanced-stack {
  display: grid;
  gap: 0.85rem;
}

.unit-edit-info-grid {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.unit-edit-info-item,
.unit-edit-advanced-panel {
  padding: 0.75rem 0;
  border: 0;
  background: transparent;
}

.unit-edit-advanced-panel + .unit-edit-advanced-panel {
  border-top: 1px solid var(--border-soft);
}

.unit-map-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.45fr);
  gap: 1rem;
  align-items: end;
}

.unit-map-wrapper {
  position: relative;
  min-height: 24rem;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--surface-muted);
}

.unit-map-wrapper what3words-map,
.unit-map-wrapper #map-container {
  display: block;
  width: 100%;
  height: 24rem;
}

.unit-w3w-search-container {
  display: block;
}

.unit-w3w-search-container input {
  width: min(22rem, calc(100vw - 4rem));
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  color: var(--text-primary);
  background: var(--field-bg);
}

.unit-geofence-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  pointer-events: none;
  border: 2px solid var(--loxal-red);
  border-radius: 50%;
  background: rgba(237, 28, 36, 0.18);
  transform: translate(-50%, -50%);
}

.unit-map-placeholder {
  display: grid;
  min-height: 24rem;
  place-items: center;
  padding: 1rem;
  color: var(--text-secondary);
  text-align: center;
}

.unit-code-user-list {
  display: grid;
  max-height: min(24rem, 48vh);
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--field-bg);
}

.unit-code-user-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}

.unit-code-user-option:last-child {
  border-bottom: 0;
}

.unit-code-user-option:hover,
.unit-code-user-option:has(.form-check-input:checked) {
  background: color-mix(in srgb, var(--surface-raised) 76%, var(--surface-tint) 24%);
}

.unit-code-user-copy {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}

.unit-code-user-name {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  font-weight: 700;
}

.unit-code-message-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.alert {
  border-radius: var(--radius-surface);
  border-width: 1px;
  box-shadow: var(--shadow-sm);
}

.alert-success {
  color: var(--text-primary);
  background: rgba(25, 111, 61, 0.12);
  border-color: rgba(25, 111, 61, 0.28);
}

.alert-info {
  color: var(--text-primary);
  background: rgba(27, 91, 142, 0.12);
  border-color: rgba(27, 91, 142, 0.24);
}

.alert-warning {
  color: var(--text-primary);
  background: rgba(180, 120, 23, 0.14);
  border-color: rgba(180, 120, 23, 0.24);
}

.alert-danger {
  color: var(--text-primary);
  background: rgba(237, 28, 36, 0.12);
  border-color: rgba(237, 28, 36, 0.24);
}

.alert-secondary {
  color: var(--text-primary);
  background: var(--surface-muted);
  border-color: var(--border-soft);
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stack-form {
  display: grid;
  gap: 1rem;
}

.form-options-disclosure {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--surface-raised) 90%, var(--surface-muted) 10%);
}

.form-options-disclosure > summary {
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.form-grid-compact {
  gap: 0.85rem;
}

.key-value-grid,
.profile-summary-grid,
.help-doc-grid {
  display: grid;
  gap: 1rem;
}

.key-value-grid,
.profile-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.profile-summary-item,
.help-doc-card {
  border: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--surface-raised) 82%, var(--surface-muted) 18%);
  box-shadow: var(--shadow-sm);
}

.context-help-launcher {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  color: #ffffff;
  background: var(--loxal-red);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 12px 30px rgba(35, 31, 32, 0.24);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.context-help-launcher:hover {
  color: #ffffff;
  background: #c6161d;
  box-shadow: 0 14px 34px rgba(35, 31, 32, 0.3);
  transform: translateY(-2px);
}

.context-help-launcher:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.24rem var(--focus-ring), 0 14px 34px rgba(35, 31, 32, 0.3);
}

.context-help-launcher .ms {
  font-size: 1.55rem;
}

.context-help-panel {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 4.2rem);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(41rem, calc(100vh - 7rem));
  color: var(--text-primary);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-surface);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.context-help-panel[hidden] {
  display: none;
}

.context-help-panel-header,
.context-help-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.context-help-panel-header {
  border-bottom: 1px solid var(--border-soft);
}

.context-help-panel-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border-soft);
  font-size: 0.84rem;
  font-weight: 600;
}

.context-help-panel-body {
  min-height: 0;
  padding: 1rem 1.1rem;
  overflow-y: auto;
}

.context-help-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.context-help-search {
  position: relative;
}

.context-help-search .ms {
  position: absolute;
  top: 50%;
  left: 0.8rem;
  z-index: 1;
  color: var(--text-muted);
  font-size: 1.05rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.context-help-search .form-control {
  padding-left: 2.45rem;
}

.context-help-result-label {
  margin: 1rem 0 0.45rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-help-topic-list {
  display: grid;
  gap: 0.35rem;
}

.context-help-topic-link {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.18rem 0.75rem;
  width: 100%;
  padding: 0.72rem 2.25rem 0.72rem 0.8rem;
  color: var(--text-primary);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
}

.context-help-topic-link:hover,
.context-help-topic-link:focus-visible {
  color: var(--text-primary);
  background: var(--surface-muted);
  border-color: var(--border-soft);
  outline: 0;
}

.context-help-topic-link-title,
.context-help-topic-link-summary {
  grid-column: 1;
}

.context-help-topic-link-title {
  font-size: 0.87rem;
  font-weight: 650;
}

.context-help-topic-link-summary {
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.35;
}

.context-help-topic-link-arrow {
  position: absolute;
  top: 50%;
  right: 0.72rem;
  color: var(--loxal-red);
  font-size: 1rem;
  transform: translateY(-50%);
}

.context-help-topic-dialog .modal-content {
  max-height: calc(100vh - 3rem);
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

html[data-theme="dark"] .context-help-topic-dialog .modal-content {
  background: #2c2728;
}

.context-help-topic-dialog .modal-header {
  border-bottom-color: var(--border-soft);
}

.context-help-topic-dialog .modal-body {
  padding: clamp(1.2rem, 3vw, 2rem);
  overflow-y: auto;
}

.context-help-markdown {
  font-size: 0.95rem;
  line-height: 1.65;
}

.context-help-markdown > :first-child {
  margin-top: 0;
}

.context-help-markdown > :last-child {
  margin-bottom: 0;
}

.context-help-markdown h1,
.context-help-markdown h2,
.context-help-markdown h3 {
  margin: 1.4rem 0 0.55rem;
}

.context-help-markdown h1 {
  font-size: 1.35rem;
}

.context-help-markdown h2 {
  font-size: 1.1rem;
}

.context-help-markdown h3 {
  font-size: 0.98rem;
}

.context-help-markdown p,
.context-help-markdown ol,
.context-help-markdown ul,
.context-help-markdown table,
.context-help-markdown blockquote,
.context-help-markdown pre {
  margin-bottom: 1rem;
}

.context-help-markdown ol,
.context-help-markdown ul {
  padding-left: 1.35rem;
}

.context-help-markdown li + li {
  margin-top: 0.35rem;
}

.context-help-markdown code {
  padding: 0.12rem 0.32rem;
  color: var(--text-primary);
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-tight);
}

.context-help-markdown blockquote {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  background: var(--surface-tint);
  border-left: 0.2rem solid var(--loxal-red);
}

.context-help-markdown table {
  width: 100%;
  border-collapse: collapse;
}

.context-help-markdown th,
.context-help-markdown td {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-soft);
  vertical-align: top;
}

.context-help-markdown th {
  background: var(--surface-muted);
}

.profile-summary-item {
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-surface);
}

.help-doc-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-surface);
}

.table-shell .section-actions {
  justify-content: flex-end;
}

.table-shell .metric-badge {
  white-space: nowrap;
}

.text-note,
body .text-secondary {
  color: var(--text-secondary) !important;
}

.small.text-secondary {
  color: var(--text-muted) !important;
}

.support-flow-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.support-flow-links a {
  color: var(--text-primary);
  font-weight: 600;
}

.support-flow-links a:hover {
  color: var(--loxal-red);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.settings-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.settings-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.settings-theme-toggle {
  justify-content: center;
  width: 100%;
}

.tenant-option-list {
  display: grid;
  gap: 0.85rem;
  margin: 0;
}

.tenant-option {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: color-mix(in srgb, var(--surface-raised) 86%, var(--surface-muted) 14%);
  cursor: pointer;
}

.tenant-option:hover,
.tenant-option:has(.form-check-input:checked) {
  border-color: rgba(237, 28, 36, 0.36);
  background: color-mix(in srgb, var(--surface-raised) 76%, var(--surface-tint) 24%);
}

.tenant-option-body {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.tenant-option-title,
.tenant-option-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.tenant-option-title {
  color: var(--text-primary);
  font-weight: 700;
}

.tenant-option-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.role-checkbox-grid {
  display: grid;
  gap: 0.45rem 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.role-checkbox-grid-compact {
  min-width: 13rem;
}

.tenant-inline-form,
.tenant-role-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.tenant-inline-form .form-select {
  width: auto;
  min-width: 8rem;
  padding-block: 0.45rem;
}

.tenant-membership-action-row td {
  padding-top: 0;
  border-top: 0;
}

.tenant-membership-actions {
  display: grid;
  grid-template-columns: minmax(12rem, 0.9fr) minmax(17rem, 1.35fr) minmax(8rem, 0.55fr);
  gap: 0.8rem;
  align-items: start;
  margin-top: 0.45rem;
  padding: 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: color-mix(in srgb, var(--surface-raised) 78%, var(--surface-muted) 22%);
}

.tenant-membership-action-panel {
  min-width: 0;
}

.tenant-membership-action-panel .h6 {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tenant-membership-role-panel .tenant-role-form {
  align-items: flex-start;
}

.tenant-membership-remove-panel {
  display: grid;
  justify-items: start;
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.7rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-soft);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.status-pill-active {
  background: rgba(27, 111, 61, 0.12);
  color: #1e7444;
}

.status-pill-pending-sync,
.status-pill-pending {
  background: rgba(180, 120, 23, 0.14);
  color: #a06212;
}

.status-pill-revoked,
.status-pill-disabled {
  background: rgba(237, 28, 36, 0.12);
  color: #c6161d;
}

.field-validation-message,
.field-validation-error,
.validation-summary-errors {
  color: #c6161d;
}

.field-validation-message {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.88rem;
}

.validation-summary:empty,
.field-validation-valid {
  display: none;
}

.validation-summary ul {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.unit-image-block {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-soft);
}

.unit-image-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.unit-image-count {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.unit-image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.unit-image-thumb,
.unit-image-dropzone-slot {
  width: 8.75rem;
  height: 8.75rem;
  flex: 0 0 auto;
  border-radius: var(--radius-surface);
}

.unit-image-thumb {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--field-bg);
  padding: 0.2rem;
  cursor: zoom-in;
}

.unit-image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.unit-image-thumb-action {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.45rem;
  height: 1.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.unit-image-thumb-action:hover,
.unit-image-thumb-action:focus {
  background: rgba(237, 28, 36, 0.86);
}

.unit-image-dropzone-slot {
  border: 2px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.unit-image-dropzone-slot:hover,
.unit-image-dropzone-slot.drag-active {
  border-color: var(--loxal-red);
  background: var(--surface-tint);
  color: var(--loxal-red);
}

.unit-image-upload-icon {
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1;
}

.unit-image-slot-hint {
  font-size: 0.78rem;
}

.unit-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.84);
}

.unit-image-lightbox.open {
  display: flex;
}

.unit-image-lightbox img {
  max-width: min(92vw, 72rem);
  max-height: 86vh;
  object-fit: contain;
  border-radius: var(--radius-surface);
  background: #111111;
}

.unit-image-lightbox-close,
.unit-image-lightbox-nav {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(35, 31, 32, 0.72);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unit-image-lightbox-close {
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-weight: 700;
}

.unit-image-lightbox-nav {
  top: 50%;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  line-height: 1;
}

.unit-image-lightbox-prev {
  left: 1rem;
}

.unit-image-lightbox-next {
  right: 1rem;
}

.unit-image-lightbox-close:hover,
.unit-image-lightbox-nav:hover {
  background: var(--loxal-red);
}

.top-shell-inner {
  min-height: var(--top-shell-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0 1.5rem;
}

.top-shell-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.shell-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-secondary);
}

.shell-menu-button:hover,
.shell-menu-button:focus {
  color: var(--text-primary);
  background: var(--surface-tint);
}

.shell-menu-button .ms {
  font-size: 1.45rem;
}

.shell-theme-toggle {
  box-shadow: none;
}

.portal-shell-layout {
  min-height: 100vh;
  padding-top: var(--top-shell-height);
}

.portal-sidebar {
  position: fixed;
  top: var(--top-shell-height);
  left: 0;
  bottom: 0;
  z-index: 1010;
  width: var(--sidebar-width);
  height: calc(100vh - var(--top-shell-height));
  border: 0;
  border-right: 1px solid var(--border-soft);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-raised) 92%, var(--loxal-dark-grey) 8%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: transform 0.18s ease, visibility 0.18s ease;
}

.portal-sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 1rem 0.75rem 0.75rem;
  overflow: hidden;
}

.side-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.side-nav::-webkit-scrollbar {
  width: 0.32rem;
}

.side-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border-strong);
}

.side-nav-item,
.side-section-label,
.side-account-summary {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.72rem;
  color: var(--text-secondary);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.side-nav-item {
  min-height: 2.24rem;
  padding: 0.48rem 0.62rem;
}

.side-nav-item:hover,
.side-nav-item.active,
.side-account-summary:hover,
.side-account-summary.active {
  color: var(--text-primary);
  background: var(--surface-tint);
}

.side-nav-item.active {
  color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--loxal-red);
}

.side-nav-item .ms {
  width: 1.25rem;
  font-size: 1.08rem;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.side-nav-item:hover .ms,
.side-nav-item.active .ms {
  color: var(--loxal-red);
}

.side-section-label {
  margin-top: 0.72rem;
  min-height: 1.78rem;
  padding: 0.28rem 0.24rem;
  color: var(--text-muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-section-rule {
  flex: 1 1 auto;
  height: 1px;
  background: var(--border-soft);
}

.side-section-text {
  flex: 0 0 auto;
}

.side-section-chevron {
  flex: 0 0 auto;
  font-size: 0.9rem;
  transition: transform 0.16s ease;
}

.side-section-label[aria-expanded="false"] .side-section-chevron {
  transform: rotate(-90deg);
}

.side-account {
  display: grid;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-soft);
}

.side-account-controls {
  display: grid;
  gap: 0.25rem;
}

.side-account-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 0.5rem;
}

.side-logout {
  justify-content: flex-start;
  color: var(--text-secondary);
}

.side-logout:hover {
  color: var(--loxal-red);
}

.portal-content-column {
  min-width: 0;
  min-height: calc(100vh - var(--top-shell-height));
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.18s ease;
}

.portal-content-column .shell-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: none;
  margin-right: auto;
  margin-left: 0;
  padding-top: 1.25rem;
  padding-right: 1.5rem;
  padding-bottom: 1rem;
  padding-left: 1.5rem;
}

.metric-card {
  display: grid;
  gap: 0.25rem;
  min-height: 6rem;
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metric-value {
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  font-weight: 750;
  line-height: 1;
}

.log-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(14rem, 1.2fr) minmax(0, 3fr);
  gap: 0.75rem;
  align-items: start;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--border-soft);
}

.dashboard-section {
  display: grid;
  gap: 1rem;
  padding: var(--surface-padding);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.dashboard-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-tile-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}

.dashboard-tile-grid-small {
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 14rem));
}

.dashboard-tile {
  display: grid;
  gap: 0.28rem;
  min-height: 6.2rem;
  padding: 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-surface);
  background: color-mix(in srgb, var(--surface-raised) 84%, var(--surface-muted) 16%);
  box-shadow: var(--shadow-sm);
}

.dashboard-tile-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-tile-value {
  color: var(--text-primary);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-tile-detail {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.dashboard-tile-good {
  border-color: rgba(34, 199, 169, 0.3);
}

.dashboard-tile-warning {
  border-color: rgba(255, 193, 7, 0.34);
  background: color-mix(in srgb, var(--surface-raised) 78%, rgba(255, 193, 7, 0.16) 22%);
}

.my-units-card {
  scroll-margin-top: 1rem;
}

.my-units-summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(16rem, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.unit-type-count-card {
  min-width: 0;
  align-content: start;
}

.unit-type-count-list {
  display: grid;
  gap: 0.45rem;
}

.unit-type-count-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.48rem 0;
  border-top: 1px solid var(--border-soft);
}

.unit-type-count-row:first-child {
  border-top: 0;
}

.unit-type-count-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.unit-type-count-row strong {
  color: var(--text-primary);
  font-size: 1.05rem;
}

.unit-interface-count-list {
  display: grid;
  gap: 0.2rem;
  padding: 0 0 0.4rem 1rem;
}

.unit-interface-count-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.unit-interface-count-row strong {
  color: inherit;
  font-size: inherit;
}

.log-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
}

.log-filter-grid .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.log-level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.34rem 0.58rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
}

.log-level-fatal,
.log-level-error {
  color: #ffffff;
  border-color: rgba(237, 28, 36, 0.65);
  background: rgba(237, 28, 36, 0.82);
}

.log-level-warning {
  color: #2d1d00;
  border-color: rgba(255, 193, 7, 0.6);
  background: rgba(255, 193, 7, 0.78);
}

.log-level-information {
  color: var(--text-primary);
  border-color: rgba(34, 199, 169, 0.36);
  background: rgba(34, 199, 169, 0.16);
}

.log-source-cell {
  max-width: 15rem;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.log-message-cell {
  min-width: 18rem;
  max-width: 34rem;
  overflow-wrap: anywhere;
}

.log-raw-modal {
  color: var(--text-primary);
  background: var(--surface-raised);
}

.log-raw-content {
  min-height: 24rem;
  padding: 1rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: var(--field-bg);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.navbar-toggler {
  border-color: var(--border-soft);
  border-radius: var(--radius-control);
  padding: 0.55rem 0.7rem;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(35,31,32,0.92)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

html[data-theme="dark"] .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.92)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (min-width: 992px) {
  .shell-controls {
    margin-left: auto;
    justify-content: flex-end;
  }

  .user-workflow-actions {
    justify-content: flex-end;
  }
}

@media (min-width: 992px) {
  .portal-sidebar.offcanvas-lg {
    position: fixed;
    visibility: visible !important;
    transform: none !important;
  }

  html.portal-sidebar-collapsed .portal-sidebar.offcanvas-lg {
    visibility: hidden !important;
    transform: translateX(-100%) !important;
  }

  html.portal-sidebar-collapsed .portal-content-column {
    margin-left: 0;
  }
}

@media (min-width: 768px) {
  .workflow-drawer-section + .workflow-drawer-section {
    padding-top: 0;
    padding-left: 1rem;
    border-top: 0;
    border-left: 1px solid var(--border-soft);
  }
}

@media (max-width: 1699.98px) {
  .unit-grid-action-table-wide .portal-action-cell {
    position: static;
    right: auto;
    box-shadow: none;
  }
}

@media (max-width: 1199.98px) {
  .codes-filter-grid {
    grid-template-columns: 1fr;
  }

  .user-action-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .user-action-summary-controls {
    width: 100%;
  }

  .user-action-summary-controls .user-workflow-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 991.98px) {
  .top-shell-inner {
    min-height: 4.75rem;
    padding: 0 0.75rem;
  }

  .portal-shell-layout {
    display: block;
    width: 100%;
    padding-top: var(--top-shell-height);
  }

  .portal-sidebar {
    top: 0;
    bottom: auto;
    width: min(20rem, 86vw);
    height: 100vh;
    border-radius: 0;
    background: var(--surface-raised);
  }

  .portal-sidebar-body {
    height: calc(100vh - 3.75rem);
  }

  .portal-content-column {
    min-height: calc(100vh - var(--top-shell-height));
    margin-left: 0;
  }

  .portal-content-column .shell-content {
    max-width: none;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .log-filter-toolbar,
  .log-filter-grid {
    grid-template-columns: 1fr;
  }

  .log-search,
  .log-filter-grid .btn {
    width: 100%;
  }

  .footer-shell.app-footer-shell {
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    text-align: center;
  }

  .app-footer-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .app-footer-shell .footer-item + .footer-item::before {
    display: none;
  }

  .brand-link {
    margin-right: 0;
    max-width: calc(100% - 5rem);
  }

  .shell-controls {
    margin-top: 1rem;
    align-items: stretch;
  }

  .tenant-switcher-form {
    align-items: stretch;
    flex-direction: column;
  }

  .tenant-shell-control,
  .tenant-switcher-form .form-select,
  .shell-account-block {
    width: 100%;
    max-width: none;
  }

  .theme-toggle {
    justify-content: center;
  }

  .unit-grid-toolbar {
    grid-template-columns: 1fr;
  }

  .portal-grid-toolbar {
    grid-template-columns: 1fr;
  }

  .portal-grid-toolbar-actions,
  .portal-grid-toolbar-actions .btn {
    width: 100%;
  }

  .portal-grid-toolbar-actions .btn {
    flex: 1 1 0;
  }

  .unit-filter-select,
  .unit-filter-menu,
  .unit-export-button {
    width: 100%;
  }

  .unit-map-fields {
    grid-template-columns: 1fr;
  }

  .unit-edit-data-grid {
    grid-template-columns: 1fr;
    row-gap: 0.55rem;
  }

  .my-units-summary-layout {
    grid-template-columns: 1fr;
  }

  .tenant-membership-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .portal-body-auth .shell-content {
    padding-top: 5rem;
  }

  .codes-action-groups {
    grid-template-columns: 1fr;
  }

  .codes-action-group + .codes-action-group {
    border-top: 1px solid var(--border-soft);
    border-left: 0;
  }

  .codes-filter-actions .btn {
    flex: 1 1 100%;
  }

  .hero-panel,
  .content-panel,
  .login-shell,
  .table-shell,
  .form-shell {
    padding: var(--surface-padding-mobile);
  }

  .user-admin-table {
    --portal-action-column-width: 16rem;
  }

  .unit-grid-action-table-wide {
    --portal-action-column-width: 8.5rem;
  }

  .feature-card,
  .workflow-card,
  .login-card {
    padding: var(--card-padding-mobile);
  }

  .login-banner {
    padding: 1.26rem;
  }

  .brand-wordmark-image {
    height: 1.2rem;
  }

  .brand-product {
    font-size: 0.84rem;
  }

  .brand-tagline {
    font-size: 0.72rem;
  }

  .hero-brandmark,
  .login-product-mark {
    justify-content: flex-start;
  }

  .privacy-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .privacy-product-mark {
    width: min(12rem, 58vw);
  }

  .help-doc-card {
    align-items: stretch;
  }

  .help-doc-card .btn,
  .theme-toggle {
    width: 100%;
  }

  .context-help-panel {
    right: 0.75rem;
    bottom: calc(max(0.75rem, env(safe-area-inset-bottom)) + 4.1rem);
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 6.5rem);
  }

  .context-help-launcher {
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .context-help-topic-dialog {
    margin: 0.75rem;
  }

  .unit-image-thumb,
  .unit-image-dropzone-slot {
    width: calc(50% - 0.375rem);
    height: auto;
    aspect-ratio: 1;
  }

  .unit-image-lightbox {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
