/* app.css */
:root {
  /* HUD tokens */
  --hud-bg: #020b1a;
  --hud-bg-soft: #040e22;
  --hud-panel: rgba(4, 14, 36, 0.88);
  --hud-panel-deep: rgba(2, 8, 22, 0.96);
  --hud-panel-hover: rgba(7, 20, 48, 0.98);

  --hud-lime: #a8ff3e;
  --hud-lime-dim: #72c22a;
  --hud-lime-glow: rgba(168, 255, 62, 0.35);
  --hud-cyan: #31e8ff;
  --hud-cyan-dim: #1db5cc;
  --hud-cyan-glow: rgba(49, 232, 255, 0.30);
  --hud-violet: #6c4bff;
  --hud-violet-dim: #8b6cff;
  --hud-violet-glow: rgba(108, 75, 255, 0.35);

  --hud-text: #d4efff;
  --hud-muted: #6a8baa;
  --hud-muted-2: #3d566e;

  --hud-line: rgba(49, 232, 255, 0.20);
  --hud-line-lime: rgba(168, 255, 62, 0.25);
  --hud-line-strong: rgba(49, 232, 255, 0.50);

  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;

  /* Compatibility aliases with current project */
  --bg: var(--hud-bg);
  --bg-soft: var(--hud-bg-soft);
  --panel: var(--hud-panel);
  --panel-strong: var(--hud-panel-deep);
  --panel-hover: var(--hud-panel-hover);
  --line: var(--hud-line);
  --line-strong: var(--hud-line-strong);

  --text: var(--hud-text);
  --muted: var(--hud-muted);
  --muted-2: var(--hud-muted-2);

  --primary: var(--hud-cyan);
  --primary-2: var(--hud-violet);
  --secondary: var(--hud-lime);
  --cyan: var(--hud-cyan);
  --green: var(--hud-lime);
  --yellow: #ffd36d;
  --red: #ff6b8a;

  --shadow-lg: 0 25px 60px rgba(0, 0, 0, 0.52);
  --shadow-md: 0 15px 35px rgba(0, 0, 0, 0.34);
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.24);

  --radius-xl: 6px;
  --radius-lg: 6px;
  --radius-md: 4px;
  --radius-sm: 4px;

  --sidebar-width: 270px;
  --topbar-height: 72px;
}

html,
body {
  background:
    radial-gradient(ellipse 60% 40% at 20% 0%, rgba(49,232,255,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 35% at 80% 5%, rgba(168,255,62,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(108,75,255,0.09) 0%, transparent 70%),
    var(--hud-bg);
  color: var(--hud-text);
  font-family: var(--font-body);
}

body {
  min-height: 100vh;
  letter-spacing: 0.02em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.06) 2px,
    rgba(0,0,0,0.06) 4px
  );
  opacity: 0.32;
  z-index: 9998;
}

.page-shell {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.container {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
}

.page-content {
  padding: 26px;
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.content-inner {
  padding: 26px;
}

h1,
h2,
h3,
h4 {
  color: #fff;
  line-height: 1.08;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

h2 {
  font-size: clamp(1.25rem, 3vw, 1.7rem);
}

h3 {
  font-size: 1rem;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

small {
  color: var(--muted-2);
  font-family: var(--font-mono);
}

a {
  transition: color .2s ease, opacity .2s ease;
}

a:hover {
  color: var(--hud-cyan);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.section-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title p {
  max-width: 780px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.ui-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 22, .82);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ui-loader-overlay.is-visible {
  display: flex;
}

.ui-loader-box {
  min-width: 260px;
  max-width: 90vw;
  padding: 20px 22px;
  position: relative;
  background: var(--hud-panel-deep);
  clip-path: polygon(12px 0%, 100% 0%, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0% 100%, 0% 12px);
  color: var(--hud-text);
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.ui-loader-box::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: inherit;
  border: 1px solid var(--hud-line);
  box-shadow: inset 0 0 0 1px rgba(49,232,255,.08), 0 0 24px rgba(49,232,255,.14);
  pointer-events: none;
}

.ui-loader-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: var(--hud-cyan);
  animation: ui-spin .85s linear infinite;
  box-shadow: 0 0 14px var(--hud-cyan-glow);
}

.ui-loader-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.is-hidden {
  display: none !important;
}

@keyframes ui-spin {
  to { transform: rotate(360deg); }
}

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

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .main-content {
    margin-left: 0;
    padding-top: calc(var(--topbar-height) + 8px);
  }

  .content-inner,
  .page-content {
    padding: 18px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.sidebar-client .sidebar-nav-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-client .sidebar-link,
.sidebar-client .sidebar-group-toggle,
.sidebar-client .sidebar-group-menu a {
  width: 100%;
  text-align: left;
  border: 0;
  text-decoration: none;
  color: inherit;
  background: transparent;
}

.sidebar-client .sidebar-link,
.sidebar-client .sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(231, 237, 255, 0.88);
  border: 1px solid transparent;
  transition: .18s ease;
}

.sidebar-client .sidebar-link:hover,
.sidebar-client .sidebar-group-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(111, 140, 255, 0.16);
  color: #fff;
}

.sidebar-client .sidebar-link.active,
.sidebar-client .sidebar-group.is-active > .sidebar-group-toggle {
  background: linear-gradient(135deg, rgba(66, 122, 255, 0.18), rgba(124, 92, 255, 0.14));
  border-color: rgba(111, 140, 255, 0.32);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(111, 140, 255, 0.08), 0 10px 24px rgba(33, 58, 120, 0.18);
}

.sidebar-client .sidebar-group {
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-client .sidebar-group.is-open {
  background: rgba(11, 18, 35, 0.6);
  border-color: rgba(111, 140, 255, 0.14);
}

.sidebar-client .sidebar-group-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.sidebar-client .sidebar-link-icon {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 14px;
  opacity: .9;
}

.sidebar-client .sidebar-group-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  font-size: 14px;
  opacity: .72;
  transition: transform .18s ease, opacity .18s ease;
}

.sidebar-client .sidebar-group.is-open > .sidebar-group-toggle .sidebar-group-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.sidebar-client .sidebar-group-menu {
  display: none;
  padding: 4px 10px 10px 18px;
  margin-left: 14px;
  border-left: 1px solid rgba(111, 140, 255, 0.16);
}

.sidebar-client .sidebar-group.is-open > .sidebar-group-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-client .sidebar-group-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(223, 230, 249, 0.78);
  font-size: .93rem;
  transition: .18s ease;
}

.sidebar-client .sidebar-group-menu a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.sidebar-client .sidebar-group-menu a.active {
  background: rgba(79, 124, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(111, 140, 255, 0.18);
}

@media (max-width: 980px) {
  .sidebar-client .sidebar-group-menu {
    margin-left: 8px;
    padding-left: 12px;
  }
}