:root {
  --nav-width: 280px;
  --nav-collapsed-width: 0px;
  --nav-handle-size: 36px;
  --page-gutter: 18px;
  --app-shell-max: 1040px;
  --app-shell-gap: 14px;
  --nav-divider-color: var(--border, rgba(255, 255, 255, 0.08));
}

body {
  background: var(--bg);
  display: block;
}

.app {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: var(--page-gutter);
}

.app-shell {
  width: min(var(--app-shell-max), 100%);
  margin: 0 auto;
  display: grid;
  gap: var(--app-shell-gap);
  align-content: start;
}

.nav-rail {
  width: min(var(--nav-width), 100%);
  padding: 10px;
  position: relative;
}

.nav-rail-title {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(233, 238, 252, 0.9);
  margin: 0;
}

.nav-rail-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 40;
  width: var(--nav-handle-size);
  height: var(--nav-handle-size);
  min-width: var(--nav-handle-size);
  min-height: var(--nav-handle-size);
  padding: 0;
  border: 1px solid var(--nav-divider-color);
  border-radius: 999px;
  background: #11192a;
  color: var(--text, #e9eefc);
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

body:not(.nav-ui-ready) .nav-rail-toggle {
  transition: none;
}

.nav-rail-toggle:hover,
.nav-rail-toggle:focus-visible {
  border-color: rgba(103, 182, 255, 0.48);
  background: #162338;
}

.nav-rail-toggle:active {
  transform: none;
}

.nav-rail-toggle:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(103, 182, 255, 0.16),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.nav-rail-toggle-icon {
  display: block;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

body.nav-rail-compact {
  padding-top: calc(var(--page-gutter) + var(--nav-handle-size) + 10px);
}

body.nav-rail-compact .nav-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 30;
  width: min(var(--nav-width), calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  border: 0;
  border-right: 1px solid var(--nav-divider-color);
  border-radius: 0;
  background: #0a101b;
  padding: 0;
  transform: translateX(-100%);
  transition: transform 0.24s ease;
  box-shadow: 24px 0 40px rgba(0, 0, 0, 0.34);
}

body.nav-rail-compact.nav-rail-open .nav-rail {
  transform: translateX(0);
}

body.nav-rail-compact.nav-rail-open .nav-rail-toggle {
  left: calc(min(var(--nav-width), 100vw - 28px) - (var(--nav-handle-size) / 2));
}

body.nav-rail-compact .nav-rail-sections {
  height: 100%;
  align-content: start;
  gap: 12px;
  padding: 24px 14px 0;
  overflow-y: auto;
}

body.nav-rail-compact .nav-card {
  background: rgba(255, 255, 255, 0.03);
}

body.nav-rail-compact .app,
body.nav-rail-compact .app-shell {
  width: 100%;
}

body.nav-rail-compact::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 25;
}

body.nav-rail-compact.nav-rail-open::before {
  opacity: 1;
  pointer-events: auto;
}

.nav-rail-sections {
  display: grid;
  gap: 10px;
  scrollbar-color: rgba(103, 182, 255, 0.72) rgba(8, 12, 20, 0.88);
  scrollbar-width: thin;
}

.nav-rail-sections::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.nav-rail-sections::-webkit-scrollbar-track {
  background: rgba(8, 12, 20, 0.88);
  border-radius: 999px;
}

.nav-rail-sections::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(103, 182, 255, 0.92), rgba(103, 182, 255, 0.54));
  border: 2px solid rgba(8, 12, 20, 0.88);
  border-radius: 999px;
}

.nav-rail-sections::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(155, 255, 176, 0.9), rgba(103, 182, 255, 0.66));
}

.nav-rail-sections::-webkit-scrollbar-corner {
  background: rgba(8, 12, 20, 0.88);
}

.nav-home-card {
  display: grid;
  gap: 8px;
}

.nav-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-card {
  border: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.14);
  padding: 8px;
}

.nav-group-title {
  color: rgba(233, 238, 252, 0.62);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0 2px;
}

.nav-rail-list {
  display: grid;
  gap: 8px;
}

.nav-rail-link {
  display: block;
  text-decoration: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.18);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  transition: background 0.15s ease, transform 0.06s ease;
}

.nav-rail-link:hover {
  background: rgba(0, 0, 0, 0.24);
}

.nav-rail-link:active {
  transform: translateY(1px);
}

.nav-rail-link.is-active {
  background: linear-gradient(180deg, rgba(103, 182, 255, 0.24), rgba(103, 182, 255, 0.08));
}

.nav-rail.is-collapsed {
  width: var(--nav-collapsed-width);
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.nav-rail.is-collapsed .nav-rail-sections {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 760px) {
  body.nav-rail-compact {
    padding-top: calc(12px + var(--nav-handle-size) + 10px);
  }

  body.nav-rail-compact .nav-rail-toggle {
    top: 12px;
    left: 12px;
  }
}

@media (min-width: 1280px) {
  body.nav-rail-compact {
    padding-top: 0;
  }

  body {
    padding: 0;
  }

  .nav-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 20;
    width: var(--nav-width);
    border: 0;
    border-right: 1px solid var(--nav-divider-color);
    border-radius: 0;
    background: #0a101b;
    padding: 0;
    overflow: visible;
    transition:
      width 0.24s ease,
      background 0.24s ease,
      border-color 0.24s ease,
      transform 0.24s ease;
  }

  .nav-rail-sections {
    height: 100%;
    align-content: start;
    gap: 12px;
    padding: var(--page-gutter) 14px 0;
    overflow-y: auto;
    transition: opacity 0.18s ease, visibility 0.18s ease;
  }

  .nav-rail-toggle {
    top: 50%;
    left: calc(var(--nav-width) - (var(--nav-handle-size) / 2));
    transform: translateY(-50%);
    z-index: 30;
  }

  .nav-rail.is-collapsed:not(.nav-rail-overlay) + .nav-rail-toggle {
    left: calc(var(--nav-collapsed-width) - (var(--nav-handle-size) / 2));
  }

  .nav-rail-toggle:active {
    transform: translateY(-50%);
  }

  .nav-rail:not(.nav-rail-overlay) ~ .app-shell {
    margin-left: calc(var(--nav-width) + var(--page-gutter));
    width: calc(100% - var(--nav-width) - var(--page-gutter));
  }

  .nav-rail.is-collapsed:not(.nav-rail-overlay) ~ .app-shell,
  .nav-rail.nav-rail-overlay ~ .app-shell {
    margin-left: var(--page-gutter);
    width: calc(100% - var(--page-gutter));
  }

  .app-shell {
    max-width: none;
    margin-inline: 0;
    transition: margin-left 0.24s ease, width 0.24s ease;
  }

  .app-shell > * {
    width: min(var(--app-shell-max), 100%);
    margin-inline: auto;
  }

  .nav-card {
    background: rgba(255, 255, 255, 0.03);
  }

  .nav-rail.nav-rail-overlay {
    width: var(--nav-width);
    transform: translateX(calc(-1 * var(--nav-width) + (var(--nav-handle-size) / 2)));
  }

  .nav-rail.nav-rail-overlay.nav-rail-peek,
  .nav-rail.nav-rail-overlay:hover,
  .nav-rail.nav-rail-overlay:focus-within {
    transform: translateX(0);
  }

  .nav-rail.nav-rail-overlay + .nav-rail-toggle {
    left: 16px;
    top: 50%;
  }
}

body.is-fullscreen-view .nav-rail,
body.is-fullscreen-view .nav-rail-toggle,
body.clock-fullscreen .nav-rail,
body.clock-fullscreen .nav-rail-toggle {
  display: none !important;
}

body.is-fullscreen-view .app-shell,
body.clock-fullscreen .app-shell {
  margin-left: 0 !important;
  width: 100% !important;
}

body.is-fullscreen-view .app-shell > *,
body.clock-fullscreen .app-shell > * {
  width: 100%;
  margin-inline: 0;
}
