@import url("tokens-sH63e1F.css");

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bh-color-page);
}

body {
  margin: 0;
  font-family: var(--bh-font-sans);
  color: var(--bh-color-text);
  background: var(--bh-color-page);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--bh-color-focus) 40%, transparent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ui-icon,
.nav-item__icon,
.profile__chevron {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ui-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--bh-sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns var(--bh-transition-fast);
}

.sidebar-overlay {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--bh-space-5) var(--bh-space-4);
  background: var(--bh-color-sidebar);
  color: var(--bh-color-sidebar-text);
}

.sidebar__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--bh-space-2);
}

.brand {
  min-width: 0;
  padding: var(--bh-space-1) var(--bh-space-3) var(--bh-space-5);
  white-space: nowrap;
}

.brand__name {
  margin: 0;
  font-size: var(--bh-font-size-lg);
  font-weight: 750;
  letter-spacing: 0.04em;
}

.brand__tenant {
  margin: var(--bh-space-2) 0 0;
  overflow: hidden;
  color: var(--bh-color-sidebar-muted);
  font-size: var(--bh-font-size-sm);
  text-overflow: ellipsis;
}

.sidebar__mobile-close {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--bh-radius-md);
  background: transparent;
  color: var(--bh-color-sidebar-text);
  cursor: pointer;
}

.sidebar__mobile-close:hover {
  background: var(--bh-color-sidebar-surface);
}

.sidebar__nav {
  display: grid;
  gap: var(--bh-space-3);
}

.nav-group {
  min-width: 0;
}

.sidebar__label {
  margin: var(--bh-space-3) var(--bh-space-3) var(--bh-space-2);
  color: var(--bh-color-sidebar-muted);
  font-size: var(--bh-font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.nav-list {
  display: grid;
  gap: var(--bh-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item,
.sidebar-toggle {
  position: relative;
  width: 100%;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: var(--bh-space-3);
  padding: 0 var(--bh-space-3);
  border: 0;
  border-radius: var(--bh-radius-md);
  background: transparent;
  color: var(--bh-color-sidebar-text);
  font-size: var(--bh-font-size-sm);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--bh-transition-fast), color var(--bh-transition-fast);
}

.nav-item__icon {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 1.2rem;
}

.nav-item__label,
.sidebar-toggle__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover,
.nav-item[aria-current='page'],
.sidebar-toggle:hover {
  background: var(--bh-color-sidebar-surface);
}

.nav-item[aria-current='page'] {
  color: #fff;
}

.nav-item--pending {
  color: var(--bh-color-sidebar-muted);
  cursor: default;
}

.sidebar__bottom {
  display: grid;
  gap: var(--bh-space-2);
  margin-top: auto;
  padding-top: var(--bh-space-5);
}

.nav-list--utility {
  padding-top: var(--bh-space-3);
  border-top: 1px solid rgb(255 255 255 / 0.08);
}

.sidebar-toggle {
  cursor: pointer;
}

.app-main {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bh-space-4);
  padding: 0 var(--bh-space-8);
  border-bottom: 1px solid var(--bh-color-border);
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(14px);
}

.topbar__left,
.topbar__actions {
  display: flex;
  align-items: center;
}

.topbar__left {
  min-width: 0;
  gap: var(--bh-space-3);
}

.topbar__actions {
  gap: var(--bh-space-3);
}

.mobile-menu-button {
  display: none;
  width: 2.65rem;
  height: 2.65rem;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--bh-color-border);
  border-radius: var(--bh-radius-md);
  background: var(--bh-color-surface);
  cursor: pointer;
}

.topbar__context {
  min-width: 0;
}

.topbar__eyebrow {
  margin: 0 0 var(--bh-space-1);
  color: var(--bh-color-text-muted);
  font-size: var(--bh-font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.topbar__title {
  margin: 0;
  overflow: hidden;
  font-size: var(--bh-font-size-xl);
  line-height: var(--bh-line-height-tight);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  position: relative;
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--bh-color-border);
  border-radius: var(--bh-radius-md);
  background: var(--bh-color-surface);
  color: var(--bh-color-text);
}

.icon-button img {
  width: 1.2rem;
  height: 1.2rem;
}

.notification-dot {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 0.42rem;
  height: 0.42rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--bh-color-primary);
}

.profile-menu-wrap {
  position: relative;
}

.profile {
  display: flex;
  align-items: center;
  gap: var(--bh-space-3);
}

.profile--button {
  min-height: 3rem;
  padding: var(--bh-space-1) var(--bh-space-2);
  border: 1px solid transparent;
  border-radius: var(--bh-radius-md);
  background: transparent;
  cursor: pointer;
}

.profile--button:hover,
.profile--button[aria-expanded='true'] {
  border-color: var(--bh-color-border);
  background: var(--bh-color-surface-muted);
}

.profile__avatar {
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--bh-color-primary-soft);
  color: var(--bh-color-primary);
  font-size: var(--bh-font-size-sm);
  font-weight: 800;
}

.profile__text {
  display: grid;
  gap: 0.1rem;
  text-align: left;
}

.profile__name {
  font-size: var(--bh-font-size-sm);
  font-weight: 700;
}

.profile__role {
  color: var(--bh-color-text-muted);
  font-size: var(--bh-font-size-xs);
}

.profile__chevron {
  width: 1rem;
  height: 1rem;
  color: var(--bh-color-text-muted);
}

.profile-menu {
  position: absolute;
  top: calc(100% + var(--bh-space-2));
  right: 0;
  z-index: 50;
  width: min(20rem, calc(100vw - 2rem));
  padding: var(--bh-space-2);
  border: 1px solid var(--bh-color-border);
  border-radius: var(--bh-radius-lg);
  background: var(--bh-color-surface);
  box-shadow: 0 1rem 2.5rem rgb(15 30 25 / 0.16);
}

.profile-menu[hidden] {
  display: none;
}

.profile-menu__identity {
  display: grid;
  gap: 0.2rem;
  padding: var(--bh-space-3);
}

.profile-menu__identity strong {
  font-size: var(--bh-font-size-sm);
}

.profile-menu__identity span {
  overflow: hidden;
  color: var(--bh-color-text-muted);
  font-size: var(--bh-font-size-xs);
  text-overflow: ellipsis;
}

.profile-menu__separator {
  height: 1px;
  margin: var(--bh-space-1) 0;
  background: var(--bh-color-border);
}

.profile-menu__item {
  width: 100%;
  text-decoration: none;
  min-height: 2.65rem;
  display: flex;
  align-items: center;
  gap: var(--bh-space-3);
  padding: 0 var(--bh-space-3);
  border: 0;
  border-radius: var(--bh-radius-md);
  background: transparent;
  color: var(--bh-color-text);
  font-size: var(--bh-font-size-sm);
  text-align: left;
  cursor: pointer;
}

.profile-menu__item:hover {
  background: var(--bh-color-surface-muted);
}

.profile-menu__item:disabled {
  color: var(--bh-color-text-muted);
  cursor: default;
}

.profile-menu__item--logout {
  color: var(--bh-color-danger);
}

.profile-menu__logout {
  margin: 0;
}

.content {
  width: min(100%, var(--bh-content-max));
  margin: 0 auto;
  padding: var(--bh-space-8);
  flex: 1 0 auto;
}

.system-footer {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--bh-space-2);
  padding: var(--bh-space-3) var(--bh-space-6);
  border-top: 1px solid var(--bh-color-border);
  color: var(--bh-color-text-muted);
  background: rgb(255 255 255 / 0.65);
  font-size: var(--bh-font-size-xs);
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: var(--bh-space-2);
  font-weight: 700;
}

.system-status__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
}

.system-status--unknown {
  color: var(--bh-color-text-muted);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--bh-space-4);
  margin-bottom: var(--bh-space-8);
}

.page-heading h1 {
  margin: 0;
  font-size: var(--bh-font-size-3xl);
  line-height: var(--bh-line-height-tight);
}

.page-heading p {
  margin: var(--bh-space-2) 0 0;
  color: var(--bh-color-text-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--bh-space-4);
}

.card {
  border: 1px solid var(--bh-color-border);
  border-radius: var(--bh-radius-lg);
  background: var(--bh-color-surface);
  box-shadow: var(--bh-shadow-card);
}

.kpi-card {
  padding: var(--bh-space-5);
}

.kpi-card__label {
  margin: 0;
  color: var(--bh-color-text-muted);
  font-size: var(--bh-font-size-sm);
  font-weight: 600;
}

.kpi-card__value {
  margin: var(--bh-space-3) 0 0;
  font-size: var(--bh-font-size-2xl);
  font-weight: 780;
  line-height: var(--bh-line-height-tight);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 0.75fr);
  gap: var(--bh-space-5);
  margin-top: var(--bh-space-5);
}

.panel {
  min-height: 19rem;
  padding: var(--bh-space-6);
}

.panel__header {
  display: flex;
  justify-content: space-between;
  gap: var(--bh-space-4);
  margin-bottom: var(--bh-space-6);
}

.panel__title {
  margin: 0;
  font-size: var(--bh-font-size-lg);
}

.panel__meta {
  color: var(--bh-color-text-muted);
  font-size: var(--bh-font-size-sm);
}

.empty-state {
  min-height: 12rem;
  display: grid;
  place-items: center;
  padding: var(--bh-space-6);
  border: 1px dashed var(--bh-color-border);
  border-radius: var(--bh-radius-md);
  background: var(--bh-color-surface-muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: var(--bh-space-2);
}

.empty-state span {
  color: var(--bh-color-text-muted);
  font-size: var(--bh-font-size-sm);
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(20rem, 0.9fr) minmax(24rem, 1.1fr);
  background: var(--bh-color-page);
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 5rem);
  background: var(--bh-color-sidebar);
  color: #fff;
}

.login-brand__name {
  font-size: var(--bh-font-size-xl);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.login-brand__copy {
  max-width: 31rem;
}

.login-brand__copy h1 {
  margin: 0 0 var(--bh-space-4);
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1.05;
}

.login-brand__copy p {
  margin: 0;
  color: var(--bh-color-sidebar-muted);
  font-size: var(--bh-font-size-lg);
}

.login-wrap {
  display: grid;
  place-items: center;
  padding: var(--bh-space-8);
}

.login-card {
  width: min(100%, 28rem);
  padding: var(--bh-space-8);
}

.login-card h2 {
  margin: 0;
  font-size: var(--bh-font-size-2xl);
}

.login-card__intro {
  margin: var(--bh-space-2) 0 var(--bh-space-6);
  color: var(--bh-color-text-muted);
}

.field {
  display: grid;
  gap: var(--bh-space-2);
  margin-top: var(--bh-space-4);
}

.field label,
.field__label {
  font-size: var(--bh-font-size-sm);
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0 var(--bh-space-4);
  border: 1px solid var(--bh-color-border);
  border-radius: var(--bh-radius-md);
  background: #fff;
  color: var(--bh-color-text);
}

.field textarea {
  min-height: 7rem;
  padding-block: var(--bh-space-3);
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--bh-color-primary);
}

.button-primary {
  width: 100%;
  min-height: 3rem;
  margin-top: var(--bh-space-6);
  border: 1px solid var(--bh-color-primary);
  border-radius: var(--bh-radius-md);
  background: var(--bh-color-primary);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  transition: background var(--bh-transition-fast);
}

.button-primary:hover {
  background: var(--bh-color-primary-hover);
}

.alert {
  margin-bottom: var(--bh-space-4);
  padding: var(--bh-space-3) var(--bh-space-4);
  border-radius: var(--bh-radius-md);
  background: #f8eaea;
  color: var(--bh-color-danger);
  font-size: var(--bh-font-size-sm);
}

@media (min-width: 821px) {
  .app-shell--collapsed {
    grid-template-columns: 4.75rem minmax(0, 1fr);
  }

  .app-shell--collapsed .sidebar {
    padding-inline: var(--bh-space-3);
  }

  .app-shell--collapsed .brand {
    width: 100%;
    padding-inline: 0;
    text-align: center;
  }

  .app-shell--collapsed .brand__name {
    font-size: 0;
  }

  .app-shell--collapsed .brand__name::before {
    content: 'BH';
    font-size: var(--bh-font-size-sm);
    font-weight: 800;
    letter-spacing: 0.04em;
  }

  .app-shell--collapsed .brand__tenant,
  .app-shell--collapsed .sidebar__label,
  .app-shell--collapsed .nav-item__label,
  .app-shell--collapsed .sidebar-toggle__label {
    display: none;
  }

  .app-shell--collapsed .sidebar__nav {
    gap: var(--bh-space-2);
  }

  .app-shell--collapsed .nav-item,
  .app-shell--collapsed .sidebar-toggle {
    justify-content: center;
    padding-inline: 0;
  }

  .app-shell--collapsed [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 0.65rem);
    top: 50%;
    z-index: 70;
    padding: 0.45rem 0.65rem;
    border-radius: var(--bh-radius-md);
    background: #17231f;
    color: #fff;
    font-size: var(--bh-font-size-xs);
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-0.25rem);
    transition: opacity var(--bh-transition-fast), transform var(--bh-transition-fast);
    white-space: nowrap;
  }

  .app-shell--collapsed [data-tooltip]:hover::after,
  .app-shell--collapsed [data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: block;
    background: rgb(4 13 10 / 0.52);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--bh-transition-fast);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(20rem, calc(100vw - 3rem));
    height: 100dvh;
    transform: translateX(-105%);
    box-shadow: 1rem 0 2.5rem rgb(0 0 0 / 0.22);
    transition: transform var(--bh-transition-fast);
  }

  .app-shell--drawer-open .sidebar {
    transform: translateX(0);
  }

  .app-shell--drawer-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar__mobile-close,
  .mobile-menu-button {
    display: grid;
  }

  .sidebar-toggle {
    display: none;
  }

  .topbar {
    min-height: 4.25rem;
    padding: var(--bh-space-3) var(--bh-space-4);
    border-bottom-color: rgb(255 255 255 / 0.08);
    background: var(--bh-color-sidebar);
    color: var(--bh-color-sidebar-text);
    backdrop-filter: none;
  }

  .topbar__title {
    color: #fff;
  }

  .topbar .mobile-menu-button,
  .topbar .icon-button {
    border-color: rgb(255 255 255 / 0.16);
    background: var(--bh-color-sidebar-surface);
    color: var(--bh-color-sidebar-text);
  }

  .topbar .icon-button img {
    filter: brightness(0) invert(1);
  }

  .topbar .notification-dot {
    border-color: var(--bh-color-sidebar-surface);
  }

  .topbar .profile__avatar {
    background: var(--bh-color-sidebar-surface);
    color: #fff;
  }

  .topbar__eyebrow {
    display: none;
  }

  .profile__text,
  .profile__chevron {
    display: none;
  }

  .profile--button {
    min-height: auto;
    padding: 0;
  }

  .content {
    padding: var(--bh-space-5);
  }

  .system-footer {
    justify-content: flex-start;
    padding-inline: var(--bh-space-5);
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 16rem;
  }

  .login-brand__copy h1 {
    font-size: 2.4rem;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar__title {
    font-size: var(--bh-font-size-lg);
  }

  .topbar__actions {
    gap: var(--bh-space-2);
  }

  .icon-button,
  .mobile-menu-button,
  .profile__avatar {
    width: 2.5rem;
    height: 2.5rem;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel {
    min-height: auto;
    padding: var(--bh-space-5);
  }

  .system-footer {
    gap: var(--bh-space-1) var(--bh-space-2);
    padding: var(--bh-space-4);
  }

  .login-wrap {
    padding: var(--bh-space-4);
  }

  .login-card {
    padding: var(--bh-space-6);
  }
}