:root {
  --black-900: #08090b;
  --black-800: #0f1115;
  --black-700: #161a21;
  --black-600: #1f2530;
  --white-100: #f4f7fb;
  --white-300: #c8d0dd;
  --line: rgba(255, 255, 255, 0.2);
  --topbar-height: 68px;
  --footer-height: 44px;
  --search-offset-top: 110px;
  --dashboards-offset-top: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--white-100);
  background-color: #000000;
  background-image: url("../images/P90632432_highRes_the-new-bmw-i3-50-xd.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow: hidden;
}

.page-shell {
  max-width: 1920px;
  height: 100vh;
  margin: 0 auto;
  padding: 0;
  display: grid;
  align-content: start;
  gap: 0;
}

.content-stage {
  position: relative;
  width: min(1920px, calc(100% - 40px));
  height: calc(100vh - var(--topbar-height) - var(--footer-height));
  margin: 0 auto;
}

.top-bar-box {
  background: rgba(8, 9, 11, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  height: var(--topbar-height);
  display: flex;
  align-items: stretch;
  overflow: visible;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 50;
}

.brand-wrap,
.profile-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.logo-btn {
  border: 0;
  padding: 0 18px;
  margin: 0;
  height: var(--topbar-height);
  width: auto;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.logo {
  height: calc(var(--topbar-height) - 4px);
  width: auto;
  display: block;
  max-width: 250px;
}

.brand-wrap {
  border-right: 1px solid rgba(255, 255, 255, 0.16);
}

.profile-wrap {
  width: 84px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  transition: background-color 0.24s ease;
}

.profile-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.profile-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: invert(1);
  transition: filter 0.24s ease;
  display: block;
}

.profile-wrap:hover,
.profile-wrap:focus-within {
  background: #f5f7fb;
}

.profile-wrap:hover .profile-icon,
.profile-wrap:focus-within .profile-icon {
  filter: invert(0);
}

.category-nav {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  grid-auto-rows: var(--topbar-height);
  min-width: 0;
  height: var(--topbar-height);
}

.category-btn {
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  background: transparent;
  color: var(--white-100);
  width: 100%;
  height: 100%;
  min-height: var(--topbar-height);
  padding: 0 8px;
  font-size: 0.80rem;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
  will-change: background-color, color;
  transform: translateZ(0);
}

.category-btn:last-child {
  border-right: 0;
}

.category-btn:hover,
.category-btn:focus-visible,
.category-btn.is-active {
  outline: none;
  background: #f5f7fb;
  color: #0f1115;
}

.hero-box {
  position: absolute;
  inset: 0;
  border: 0;
  overflow: visible;
  box-shadow: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: var(--search-offset-top) 28px 0;
}

.search-block {
  width: min(760px, 100%);
  position: relative;
  z-index: 5;
  display: grid;
  gap: 8px;
}

.search-wrap {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.search-wrap input {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  background: rgba(18, 20, 24, 0.72);
  color: var(--white-100);
  padding: 12px 14px;
  font-size: 1rem;
  min-width: 0;
  color-scheme: dark;
}

.search-wrap input::-webkit-search-cancel-button {
  filter: brightness(0) invert(1);
  opacity: 0.7;
  cursor: pointer;
}

.search-wrap input::placeholder {
  color: rgba(244, 247, 251, 0.56);
}

.search-results-panel {
  --search-results-max-height: 280px;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(8, 9, 11, 0.9);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.search-results-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.search-results-inner {
  overflow-y: auto;
  max-height: var(--search-results-max-height);
}

.search-results-inner::-webkit-scrollbar {
  width: 6px;
}

.search-results-inner::-webkit-scrollbar-track {
  background: transparent;
}

.search-results-inner::-webkit-scrollbar-thumb {
  background: rgba(244, 247, 251, 0.28);
  border-radius: 6px;
}

.search-results-inner::-webkit-scrollbar-thumb:hover {
  background: rgba(244, 247, 251, 0.48);
}

.search-results-list {
  margin: 0;
  padding: 6px;
  list-style: none;
  display: grid;
  gap: 4px;
}

.search-result-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--white-100);
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.search-result-item:hover,
.search-result-item:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
}

.search-result-item.is-loading {
  pointer-events: none;
  position: relative;
  padding-right: 32px;
}

.search-result-item.is-loading::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  margin-top: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(244, 247, 251, 0.2);
  border-top-color: var(--white-100);
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--white-300);
  font-weight: 600;
}

.search-result-name {
  font-size: 0.9rem;
  color: var(--white-100);
}

.search-results-empty {
  padding: 10px;
  color: rgba(244, 247, 251, 0.6);
  font-size: 0.9rem;
  text-align: left;
}

.dashboards-box {
  position: absolute;
  top: var(--dashboards-offset-top);
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  background: rgba(8, 9, 11, 0.82);
  padding: 8px 18px 14px;
  display: grid;
  gap: 14px;
  max-height: calc(100% - var(--dashboards-offset-top) - 8px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 247, 251, 0.28) transparent;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.dashboards-box::-webkit-scrollbar {
  width: 6px;
}

.dashboards-box::-webkit-scrollbar-track {
  background: transparent;
}

.dashboards-box::-webkit-scrollbar-thumb {
  background: rgba(244, 247, 251, 0.28);
  border-radius: 6px;
}

.dashboards-box::-webkit-scrollbar-thumb:hover {
  background: rgba(244, 247, 251, 0.48);
}

.dashboards-title {
  display: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.dashboard-grid.is-swapping {
  opacity: 0;
  transform: translateY(6px);
}

.dashboard-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.dashboard-card:hover,
.dashboard-card:focus-within {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.34);
  transform: translateY(-2px);
}

.dashboard-card.is-locked {
  cursor: not-allowed;
  opacity: 0.38;
  pointer-events: none;
}

.dashboard-card.is-loading {
  pointer-events: none;
  position: relative;
}

.dashboard-card.is-loading .dashboard-thumb,
.dashboard-card.is-loading .dashboard-name {
  filter: blur(3px);
  opacity: 0.5;
}

.dashboard-card.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: inherit;
}

.dashboard-card.is-loading::before {
  content: "";
  position: absolute;
  top: calc(50% - 14px);
  left: calc(50% - 14px);
  width: 28px;
  height: 28px;
  border: 2px solid rgba(244, 247, 251, 0.2);
  border-top-color: var(--white-100);
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
  z-index: 2;
}

.dashboard-empty {
  color: var(--white-300);
  font-size: 0.92rem;
  padding: 16px 4px;
}

.dashboard-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-name {
  flex: 0 0 auto;
  margin: 10px 2px 2px;
  font-size: 0.92rem;
  color: var(--white-100);
}

.profile-popup-label {
  color: var(--white-300);
  margin-right: 4px;
}

.is-hidden-panel {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.profile-popup {
  position: fixed;
  z-index: 200;
  width: 190px;
  background: rgba(8, 9, 11, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.profile-popup.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.profile-popup-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--white-100);
}

.profile-popup-department {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--white-300);
}

.profile-popup-role {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--white-300);
  min-height: 1em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  :root {
    --topbar-height: 52px;
    --search-offset-top: 82px;
    --dashboards-offset-top: 18px;
  }

  .category-nav {
    display: none;
  }

  .dashboards-dropdown-wrap {
    display: flex !important;
  }

  .hero-content {
    padding: var(--search-offset-top) 18px 0;
  }

  .dashboards-box {
    padding: 10px 14px 12px;
    max-height: calc(100% - var(--dashboards-offset-top) - 8px);
  }
}

.page-footer {
  display: none;
}

.footer-logo,
.footer-bmw-logo {
  display: none;
}

.dashboards-dropdown-wrap {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
  position: relative;
}

.dashboards-dropdown-btn {
  border: 0;
  background: transparent;
  color: var(--white-100);
  font-size: 0.85rem;
  padding: 0 10px;
  height: var(--topbar-height);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.24s ease, color 0.24s ease;
}

.dashboards-dropdown-btn:hover,
.dashboards-dropdown-btn.is-open {
  background: #f5f7fb;
  color: #0f1115;
}

.dashboards-dropdown-arrow {
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.dashboards-dropdown-btn.is-open .dashboards-dropdown-arrow {
  transform: rotate(180deg);
}

.dashboards-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: rgba(8, 9, 11, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
  display: grid;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.dashboards-dropdown-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dashboards-dropdown-item {
  border: 0;
  background: transparent;
  color: var(--white-100);
  text-align: left;
  padding: 10px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.dashboards-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dashboards-dropdown-item.is-active {
  background: rgba(255, 255, 255, 0.14);
  font-weight: 600;
}

@media (max-width: 640px) {
  .top-bar-box {
    height: auto;
  }

  .category-nav {
    display: none;
  }

  .dashboards-dropdown-wrap {
    display: flex !important;
  }

  .search-wrap {
    grid-template-columns: 1fr;
  }

  .search-results-panel.is-open {
    max-height: 220px;
  }
}

/* ─── Page loader ──────────────────────────────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 9, 11, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.35s ease;
}

.page-loader.is-hiding {
  opacity: 0;
  pointer-events: none;
}

.page-loader__spinner {
  width: 46px;
  height: 46px;
  border: 3px solid rgba(244, 247, 251, 0.15);
  border-top-color: var(--white-100);
  border-radius: 50%;
  animation: loader-spin 0.75s linear infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}
