:root {
  --ux-sidebar-width: clamp(260px, 18vw, 320px);
  --ux-sidebar-gap: clamp(18px, 2vw, 28px);
  --ux-content-max: min(1760px, calc(100vw - var(--ux-sidebar-width) - 72px));
  --ux-topbar-height: 76px;
  --ux-glow: 0 0 28px rgba(110, 214, 255, .14);
}

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.ux-enhanced::before {
  opacity: .74;
}

body .topbar {
  position: sticky;
  top: 0;
  z-index: 130;
  min-height: var(--ux-topbar-height);
}

body .site-main,
body .page-frame,
body .page-shell,
body .portal-main {
  min-width: 0;
}

body .site-main {
  width: 100%;
}

body .page-frame {
  width: min(var(--ux-content-max), 100%);
  margin-inline: auto;
}

body .sidebar {
  width: var(--ux-sidebar-width);
  scrollbar-width: thin;
  scrollbar-color: rgba(101, 205, 255, .42) rgba(3, 11, 20, .86);
}

body .sidebar,
body .reports-sidebar,
body .reports-main,
body .hud-panel,
body .knowledge-layout,
body .roster-grid,
body .server-shell,
body .page-frame,
body .site-main {
  min-width: 0;
}

body .sidebar-head,
body .page-heading,
body .reports-sidebar-head,
body .report-toolbar,
body .panel-header {
  backdrop-filter: blur(12px);
}

body ::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body ::-webkit-scrollbar-track {
  background: rgba(2, 10, 18, .92);
}

body ::-webkit-scrollbar-thumb {
  border: 2px solid rgba(2, 10, 18, .92);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(84, 192, 255, .92), rgba(27, 124, 228, .92));
  box-shadow: 0 0 18px rgba(88, 197, 255, .16);
}

body ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(120, 218, 255, .96), rgba(46, 145, 255, .96));
}

.command-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 160;
  height: 3px;
  transform-origin: left center;
  transform: scaleX(var(--scroll-progress-ratio, 0));
  background: linear-gradient(90deg, rgba(55, 164, 255, .4), rgba(132, 236, 255, .95), rgba(255,255,255,.95));
  box-shadow: 0 0 20px rgba(123, 227, 255, .42);
  pointer-events: none;
}

.scroll-top-button {
  position: fixed;
  right: clamp(14px, 2vw, 24px);
  bottom: clamp(14px, 2vw, 24px);
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid rgba(104, 212, 255, .34);
  background: linear-gradient(180deg, rgba(8, 27, 44, .96), rgba(3, 12, 22, .98));
  color: #d9f7ff;
  font-size: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.34), 0 0 24px rgba(58, 180, 255, .12);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease, border-color .2s ease;
  z-index: 150;
}

.scroll-top-button.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top-button:hover {
  border-color: rgba(132, 236, 255, .6);
}

.sidebar-tools {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
}

.sidebar-search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(84, 192, 255, .18);
  background: rgba(5, 15, 24, .84);
  color: #dff8ff;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.sidebar-search:focus {
  border-color: rgba(112, 214, 255, .48);
  box-shadow: 0 0 0 3px rgba(69, 171, 255, .1);
}

.sidebar-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-quick-links button {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(84, 192, 255, .18);
  background: rgba(5, 15, 24, .84);
  color: #a9d9ea;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-quick-links button:hover,
.sidebar-quick-links button.is-active {
  color: #f2fbff;
  border-color: rgba(112, 214, 255, .48);
  box-shadow: var(--ux-glow);
}

.sidebar a.is-nav-hidden,
.side-nav a.is-nav-hidden,
nav a.is-nav-hidden {
  display: none !important;
}

.sidebar-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0 8px;
  border-radius: 16px;
  border: 1px solid rgba(84, 192, 255, .14);
  background: rgba(4, 13, 22, .68);
  color: #bdefff;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.sidebar-section-label .section-count {
  color: rgba(184, 236, 255, .64);
  font-size: 10px;
}

.quick-nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(84, 192, 255, .22);
  background: rgba(4, 13, 22, .7);
  color: #daf7ff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.quick-nav-trigger kbd {
  padding: 4px 7px;
  border-radius: 8px;
  border: 1px solid rgba(84, 192, 255, .18);
  background: rgba(2, 10, 18, .86);
  font-size: 10px;
  letter-spacing: .08em;
}

.quick-nav-overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: start center;
  padding: clamp(30px, 5vw, 80px) 18px 18px;
  background: rgba(0, 6, 12, .64);
  backdrop-filter: blur(16px);
  z-index: 170;
}

.quick-nav-overlay.is-open {
  display: grid;
}

.quick-nav-dialog {
  width: min(980px, calc(100vw - 36px));
  max-height: min(78vh, 900px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr);
  border-radius: 24px;
  border: 1px solid rgba(100, 205, 255, .24);
  background: linear-gradient(180deg, rgba(5, 16, 27, .98), rgba(3, 10, 19, .99));
  box-shadow: 0 32px 90px rgba(0,0,0,.46), 0 0 32px rgba(86, 199, 255, .08);
}

.quick-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 10px;
}

.quick-nav-head strong {
  color: #effbff;
  font-size: 18px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.quick-nav-close {
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(84, 192, 255, .18);
  background: rgba(2, 10, 18, .9);
  color: #dff8ff;
  font-size: 18px;
}

.quick-nav-search-wrap {
  padding: 0 22px 16px;
}

.quick-nav-search {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(84, 192, 255, .18);
  background: rgba(2, 10, 18, .9);
  color: #effbff;
}

.quick-nav-results {
  overflow: auto;
  padding: 0 12px 18px;
}

.quick-nav-group {
  margin: 0 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(84, 192, 255, .12);
  background: rgba(5, 14, 24, .74);
}

.quick-nav-group h4 {
  margin: 0;
  padding: 14px 16px 10px;
  color: #b5ebff;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.quick-nav-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 12px;
}

.quick-nav-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(84, 192, 255, .08);
  background: rgba(3, 11, 20, .74);
  color: #dff8ff;
  text-decoration: none;
}

.quick-nav-list a small {
  color: rgba(186, 234, 255, .56);
}

.quick-nav-list a:hover {
  border-color: rgba(112, 214, 255, .4);
  box-shadow: var(--ux-glow);
}

.quick-nav-list a mark {
  padding: 0;
  background: transparent;
  color: #7be3ff;
}

.topbar .topbar-tools {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.page-heading h1,
.hero-title,
.section-title {
  text-wrap: balance;
}

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

input, select, textarea {
  max-width: 100%;
}

.page-shell,
.reports-layout,
.report-form-grid,
.report-template-grid,
.roster-grid,
.profile-grid,
.dashboard-grid,
.server-shell,
.workflow-layout {
  min-width: 0;
}

@media (min-width: 1200px) {
  body .site-main {
    padding-inline: clamp(20px, 2vw, 28px);
  }
}

@media (max-width: 1279px) {
  :root {
    --ux-sidebar-width: 290px;
    --ux-content-max: min(100%, calc(100vw - 48px));
  }
}

@media (max-width: 1024px) {
  .topbar .topbar-tools {
    order: 3;
    width: 100%;
    justify-content: flex-end;
    margin: 0;
    padding-top: 8px;
  }

  .quick-nav-trigger {
    width: 100%;
    justify-content: center;
  }

  .page-frame {
    width: 100%;
  }
}

@media (max-width: 767px) {
  .scroll-top-button {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .quick-nav-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 40px);
  }

  .quick-nav-head,
  .quick-nav-search-wrap {
    padding-inline: 14px;
  }

  .quick-nav-results {
    padding-inline: 8px;
  }
}
