/* Global layout and theme polish */
:root {
  --holxn-page-max: 1180px;
  --holxn-radius: 8px;
  --holxn-radius-sm: 6px;
  --holxn-border-soft: rgba(108, 117, 125, 0.18);
  --holxn-shadow-sm: 0 0.5rem 1.35rem rgba(15, 23, 42, 0.06);
  --holxn-shadow-md: 0 1rem 2.25rem rgba(15, 23, 42, 0.09);
  --holxn-focus: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
}

html {
  color-scheme: light dark;
  min-height: 100%;
}

html[data-bs-theme="dark"] {
  color-scheme: dark;
  --holxn-border-soft: rgba(130, 146, 166, 0.24);
  --holxn-shadow-sm: 0 0.5rem 1.35rem rgba(0, 0, 0, 0.22);
  --holxn-shadow-md: 0 1rem 2.25rem rgba(0, 0, 0, 0.32);
}

html[data-bs-theme="light"] {
  color-scheme: light;
}

body,
html {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.96) 22rem),
    var(--bs-body-bg);
  color: var(--bs-body-color);
  text-rendering: optimizeLegibility;
}

html[data-bs-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(18, 24, 31, 0.96), rgba(12, 16, 21, 0.98) 24rem),
    var(--bs-body-bg);
}

a {
  text-underline-offset: 0.18em;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

.fill {
  flex: 1 0 auto;
  width: 100%;
  padding-left: clamp(14px, 2.4vw, 28px);
  padding-right: clamp(14px, 2.4vw, 28px);
}

.footer {
  flex-shrink: 0;
  width: 100%;
  margin-top: auto !important;
  padding: 0.85rem 1rem 1.1rem;
}

.footer p {
  margin-bottom: 0;
}

.container,
.container-fluid {
  --bs-gutter-x: clamp(1rem, 2.2vw, 1.75rem);
}

.navbar {
  border-bottom: 1px solid var(--holxn-border-soft);
  box-shadow: 0 0.25rem 1.25rem rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(12px);
}

.navbar.bg-body,
.navbar-body.bg-body {
  background-color: rgba(var(--bs-body-bg-rgb), 0.92) !important;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0;
}

.navbar .nav-link {
  border-radius: var(--holxn-radius-sm);
  padding-inline: 0.65rem;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  background: rgba(var(--bs-primary-rgb), 0.08);
}

.holxn-icon-svg {
  width: 1.15em;
  height: 1.15em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card,
.modal-content,
.dropdown-menu,
.toast,
.alert {
  border-radius: var(--holxn-radius);
}

.card {
  border-color: var(--holxn-border-soft);
  box-shadow: var(--holxn-shadow-sm);
}

.card.border-0 {
  border: 1px solid var(--holxn-border-soft) !important;
}

.shadow-sm {
  box-shadow: var(--holxn-shadow-sm) !important;
}

.form-control,
.form-select,
.input-group-text,
.btn {
  border-radius: var(--holxn-radius-sm);
}

.form-control,
.form-select,
.input-group-text {
  border-color: var(--holxn-border-soft);
}

/* Modern, progressively enhanced single-select controls */
.holxn-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.holxn-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.holxn-select.is-inline-width {
  width: auto;
  min-width: 5.5rem;
}

.input-group > .holxn-select {
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
}

.holxn-select-trigger {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  color: var(--bs-body-color);
  text-align: left;
  background: rgba(var(--bs-body-bg-rgb), 0.92);
  border: 1px solid var(--holxn-border-soft);
  border-radius: var(--holxn-radius-sm);
  box-shadow: 0 0.25rem 0.8rem rgba(15, 23, 42, 0.035);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.holxn-select-trigger:hover {
  border-color: rgba(var(--bs-primary-rgb), 0.34);
  background: var(--bs-body-bg);
}

.holxn-select-trigger:focus-visible,
.holxn-select.is-open .holxn-select-trigger {
  outline: 0;
  border-color: rgba(var(--bs-primary-rgb), 0.5);
  box-shadow: var(--holxn-focus);
}

.holxn-select-trigger:disabled {
  color: var(--bs-secondary-color);
  background: var(--bs-secondary-bg);
  cursor: not-allowed;
  box-shadow: none;
}

.holxn-select-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holxn-select-value.is-placeholder {
  color: var(--bs-secondary-color);
}

.holxn-select-chevron {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  color: var(--bs-secondary-color);
  transition: transform 0.16s ease;
}

.holxn-select.is-open .holxn-select-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.holxn-select-panel {
  position: absolute;
  z-index: 1065;
  top: calc(100% + 0.45rem);
  left: 0;
  width: max(100%, 15rem);
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 0.45rem;
  background: rgba(var(--bs-body-bg-rgb), 0.98);
  border: 1px solid var(--holxn-border-soft);
  border-radius: calc(var(--holxn-radius) + 2px);
  box-shadow: var(--holxn-shadow-md);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px) scale(0.985);
  transform-origin: top center;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s;
}

.holxn-select.is-open .holxn-select-panel,
.holxn-select-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.holxn-select-panel.is-portal {
  position: fixed;
  top: auto;
  left: auto;
  z-index: 2000;
}

.holxn-select-search-wrap {
  padding: 0.15rem 0.15rem 0.45rem;
}

.holxn-select-search {
  width: 100%;
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  color: var(--bs-body-color);
  background: var(--bs-tertiary-bg);
  border: 1px solid transparent;
  border-radius: var(--holxn-radius-sm);
  outline: 0;
}

.holxn-select-search:focus {
  background: var(--bs-body-bg);
  border-color: rgba(var(--bs-primary-rgb), 0.42);
  box-shadow: var(--holxn-focus);
}

.holxn-select-options {
  max-height: min(19rem, 48vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.holxn-select-option {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  color: var(--bs-body-color);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--holxn-radius-sm);
}

.holxn-select-option:hover,
.holxn-select-option:focus-visible,
.holxn-select-option.is-active {
  outline: 0;
  background: rgba(var(--bs-primary-rgb), 0.08);
}

.holxn-select-option.is-selected {
  color: var(--bs-primary);
  font-weight: 700;
  background: rgba(var(--bs-primary-rgb), 0.11);
}

.holxn-select-option-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holxn-select-check {
  flex: 0 0 auto;
  opacity: 0;
  font-weight: 800;
}

.holxn-select-option.is-selected .holxn-select-check {
  opacity: 1;
}

.holxn-select-option:disabled {
  color: var(--bs-secondary-color);
  cursor: not-allowed;
  opacity: 0.62;
}

.holxn-select-empty {
  padding: 1rem 0.75rem;
  color: var(--bs-secondary-color);
  text-align: center;
  font-size: 0.9rem;
}

.job-person-picker {
  width: min(100%, 34rem);
}

.job-person-picker .holxn-select-panel {
  width: 100%;
  max-width: 100%;
}

.job-person-picker .form-label {
  color: var(--bs-secondary-color);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

html[data-bs-theme="dark"] .holxn-select-trigger {
  box-shadow: none;
}

@media (max-width: 575.98px) {
  .holxn-select-panel {
    width: 100%;
    max-width: calc(100vw - 1.8rem);
  }
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.page-link:focus {
  border-color: rgba(var(--bs-primary-rgb), 0.42);
  box-shadow: var(--holxn-focus);
}

.btn {
  font-weight: 600;
  letter-spacing: 0;
}

.btn-primary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-info {
  box-shadow: 0 0.45rem 1.1rem rgba(15, 23, 42, 0.08);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled,
.btn.disabled {
  transform: none;
  box-shadow: none;
}

.table {
  table-layout: fixed;
  margin-bottom: 0;
}

.table th {
  color: var(--bs-secondary-color);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.table td,
.table th {
  word-wrap: break-word;
  overflow-wrap: anywhere;
  border-color: rgba(108, 117, 125, 0.14);
}

.table-hover > tbody > tr:hover > * {
  background-color: rgba(var(--bs-primary-rgb), 0.045);
}

.badge {
  border-radius: 999px;
  font-weight: 700;
}

.modal-content {
  border-color: var(--holxn-border-soft);
  box-shadow: var(--holxn-shadow-md);
}

.modal-header,
.modal-footer,
.card-header,
.card-footer {
  border-color: rgba(108, 117, 125, 0.14);
}

.footer {
  border-top: 0;
  padding: 1rem 0 1.25rem;
  color: var(--bs-secondary-color);
  background: transparent !important;
}

.footer p {
  margin-bottom: 0;
}

.home-shell,
.consult-shell,
.contact-shell,
.mail-admin-shell,
.auth-shell,
.business-admin-shell,
.user-manage-shell,
.realm-shell,
.node-api-shell,
.node-manage-shell {
  width: min(100%, var(--holxn-page-max));
}

.home-card,
.contact-card,
.consult-hero,
.mail-admin-card,
.business-admin-panel,
.user-manage-panel,
.realm-panel,
.node-api-panel,
.node-manage-panel {
  border-radius: var(--holxn-radius);
}

.home-card,
.business-admin-card,
.user-manage-card,
.realm-port-card,
.realm-key-box,
.realm-advanced-box,
.realm-node-pill,
.node-api-result-card,
.node-manage-card {
  border-color: var(--holxn-border-soft);
}

html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .modal-content,
html[data-bs-theme="dark"] .dropdown-menu,
html[data-bs-theme="dark"] .toast,
html[data-bs-theme="dark"] .alert {
  border-color: var(--holxn-border-soft);
}

html[data-bs-theme="dark"] .table td,
html[data-bs-theme="dark"] .table th,
html[data-bs-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-footer,
html[data-bs-theme="dark"] .card-header,
html[data-bs-theme="dark"] .card-footer {
  border-color: rgba(130, 146, 166, 0.18);
}

html[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(110, 168, 254, 0.08);
}

html[data-bs-theme="dark"] .btn-primary,
html[data-bs-theme="dark"] .btn-success,
html[data-bs-theme="dark"] .btn-warning,
html[data-bs-theme="dark"] .btn-danger,
html[data-bs-theme="dark"] .btn-info {
  box-shadow: none;
}

@media (max-width: 767.98px) {
  body {
    background: var(--bs-body-bg);
  }

  .fill {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .navbar .container-fluid {
    gap: 0.25rem;
  }

  .card-body.p-4,
  .card-body.p-lg-5 {
    padding: 1rem !important;
  }

  .table-responsive,
  .overflow-x-auto {
    border-radius: var(--holxn-radius);
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive > .table,
  .overflow-x-auto > .table {
    table-layout: auto;
  }

  .table-responsive > .table th,
  .table-responsive > .table td,
  .overflow-x-auto > .table th,
  .overflow-x-auto > .table td {
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
    word-break: normal;
    white-space: nowrap;
  }

  .table-responsive > .holxn-mobile-card-table,
  .overflow-x-auto > .holxn-mobile-card-table {
    display: block;
    width: 100%;
    overflow: visible;
  }

  .holxn-mobile-card-table thead {
    display: none;
  }

  .holxn-mobile-card-table tbody {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .holxn-mobile-card-table tbody tr {
    display: block;
    width: 100%;
    padding: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    background: var(--holxn-surface-solid, var(--bs-body-bg));
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 1px 2px rgba(15, 23, 42, 0.04);
    --bs-table-bg-type: transparent;
    --bs-table-bg-state: transparent;
  }

  .holxn-mobile-card-table tbody tr:hover > *,
  .holxn-mobile-card-table tbody tr:nth-of-type(odd) > * {
    --bs-table-bg-type: transparent;
    --bs-table-bg-state: transparent;
    background-color: transparent;
  }

  .holxn-mobile-card-table tbody td {
    display: grid;
    grid-template-columns: 5.25rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    width: 100%;
    max-width: none !important;
    padding: 0.32rem 0;
    border: 0;
    overflow: visible !important;
    white-space: normal !important;
  }

  .holxn-mobile-card-table tbody td::before {
    content: attr(data-label);
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: nowrap;
  }

  .holxn-mobile-card-value {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--bs-body-color);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .holxn-mobile-card-value.is-multiline {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .holxn-mobile-card-value.is-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    overflow: visible;
    white-space: normal;
  }

  .holxn-mobile-card-value.is-actions > .d-flex,
  .holxn-mobile-card-value.is-actions .action-buttons,
  .holxn-mobile-card-value.is-actions .xcx-admin-actions,
  .holxn-mobile-card-value.is-actions .btn-group {
    display: flex;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.35rem !important;
    align-items: center;
  }

  .holxn-mobile-card-value.is-actions .btn,
  .holxn-mobile-card-value.is-actions button,
  .holxn-mobile-card-value.is-actions a.btn {
    flex: 0 0 auto;
    width: auto !important;
    margin: 0 !important;
  }

  .holxn-mobile-card-value > .badge {
    width: auto;
  }

  .holxn-mobile-card-state-row {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  .holxn-mobile-card-state-row td {
    display: block !important;
    padding: 1.5rem 0 !important;
    text-align: center;
  }

  .holxn-mobile-card-state-row td::before {
    content: none !important;
  }

  .btn:hover {
    transform: none;
  }
}

@media (max-width: 767.98px) {
  html[data-bs-theme="dark"] .holxn-mobile-card-table tbody tr {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.035),
      0 1px 2px rgba(0, 0, 0, 0.2);
  }
}

/* Modern UI coordination pass */
:root {
  --holxn-surface: rgba(255, 255, 255, 0.82);
  --holxn-surface-solid: #ffffff;
  --holxn-surface-muted: rgba(248, 250, 252, 0.88);
  --holxn-shadow-sm: 0 0.35rem 1rem rgba(15, 23, 42, 0.055);
  --holxn-shadow-md: 0 0.8rem 2rem rgba(15, 23, 42, 0.08);
}

html[data-bs-theme="dark"] {
  --holxn-surface: rgba(22, 27, 34, 0.86);
  --holxn-surface-solid: #161b22;
  --holxn-surface-muted: rgba(30, 36, 44, 0.78);
  --holxn-shadow-sm: 0 0.35rem 1rem rgba(0, 0, 0, 0.22);
  --holxn-shadow-md: 0 0.8rem 2rem rgba(0, 0, 0, 0.32);
}

body {
  background:
    linear-gradient(180deg, rgba(247, 248, 250, 0.96), rgba(255, 255, 255, 0.98) 18rem),
    var(--bs-body-bg);
}

html[data-bs-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(14, 18, 23, 0.98), rgba(10, 13, 17, 0.98) 18rem),
    var(--bs-body-bg);
}

.card,
.modal-content,
.dropdown-menu,
.toast,
.alert,
.table-responsive {
  border: 1px solid var(--holxn-border-soft);
}

.card,
.modal-content,
.dropdown-menu,
.toast {
  background-color: var(--holxn-surface);
  backdrop-filter: blur(10px);
}

.card-header,
.card-footer,
.modal-header,
.modal-footer {
  background: transparent;
}

.btn,
.form-control,
.form-select,
.input-group-text,
.page-link {
  min-height: 2.35rem;
}

.btn {
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-primary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-info {
  box-shadow: 0 0.35rem 0.85rem rgba(15, 23, 42, 0.07);
}

.form-control,
.form-select,
.input-group-text {
  background-color: var(--holxn-surface-solid);
}

.table thead th {
  background: var(--holxn-surface-muted);
}

.navbar {
  min-height: 3.75rem;
}

@media (max-width: 767.98px) {
  .card,
  .modal-content,
  .dropdown-menu,
  .toast,
  .alert,
  .table-responsive {
    backdrop-filter: none;
  }
}

/* Loading and skeleton states */
.holxn-page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2000;
  overflow: hidden;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.holxn-page-loader.is-hidden {
  opacity: 0;
}

.holxn-page-loader span {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--bs-primary), transparent);
  animation: holxnLoaderSlide 1.05s ease-in-out infinite;
}

@keyframes holxnLoaderSlide {
  from { transform: translateX(-120%); }
  to { transform: translateX(260%); }
}

.holxn-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--holxn-radius-sm, 6px);
  background: rgba(108, 117, 125, 0.14);
  color: transparent !important;
}

.holxn-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  animation: holxnSkeletonShimmer 1.2s ease-in-out infinite;
}

@keyframes holxnSkeletonShimmer {
  to { transform: translateX(100%); }
}

.holxn-skeleton-line {
  display: block;
  height: 0.9rem;
  width: 100%;
}

html[data-bs-theme="dark"] .holxn-skeleton {
  background: rgba(130, 146, 166, 0.18);
}

html[data-bs-theme="dark"] .holxn-skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

/* Theme toggle */

.theme-toggle-wrap {
  display: inline-flex;
  align-items: center;
}
.theme-toggle-btn {
  width: 2.35rem;
  min-height: 2.35rem;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--holxn-radius-sm, 6px);
  color: var(--bs-body-color) !important;
  text-decoration: none;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
  background: rgba(var(--bs-primary-rgb), 0.08);
}

.theme-toggle-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.88;
}

.theme-toggle-btn.is-dark .theme-toggle-icon {
  opacity: 0.92;
}

.theme-toggle-auto-fill {
  fill: currentColor;
  stroke: none;
  opacity: 0.6;
}
