/* Subtle grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
}

/* 侧栏 fixed + 主区 margin，与文档滚动解耦；折叠宽度由 html 类切换 */
:root {
  --sidebar-w-expanded: 16rem;
  --sidebar-w-collapsed: 4.5rem;
  --sidebar-w: var(--sidebar-w-expanded);
}
html.am-sidebar-collapsed {
  --sidebar-w: var(--sidebar-w-collapsed);
}
#sidebar {
  width: var(--sidebar-w);
  transition: width 0.2s ease;
}
#main-app {
  margin-left: var(--sidebar-w);
  transition: margin-left 0.2s ease;
}

.sidebar-when-collapsed {
  display: none;
}
html.am-sidebar-collapsed .sidebar-when-expanded {
  display: none;
}
html.am-sidebar-collapsed .sidebar-when-collapsed {
  display: flex;
}
html.am-sidebar-collapsed .sidebar-brand-text {
  display: none;
}
html.am-sidebar-collapsed .sidebar-reset-hint {
  display: none;
}
html.am-sidebar-collapsed .sidebar-header-inner {
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
html.am-sidebar-collapsed .sidebar-brand-wrap {
  flex: 0 0 auto;
  justify-content: center;
}
.sidebar-toggle-icon-collapsed {
  display: none;
}
html.am-sidebar-collapsed .sidebar-toggle-icon-expanded {
  display: none !important;
}
html.am-sidebar-collapsed .sidebar-toggle-icon-collapsed {
  display: block !important;
}
html.am-sidebar-collapsed #nav .nav-item svg {
  width: 1.35rem;
  height: 1.35rem;
}

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

.scroll-thin {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) rgba(15, 23, 42, 0.35);
}
.scroll-thin::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.scroll-thin::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.35);
  border-radius: 999px;
}
.scroll-thin::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.scroll-thin::-webkit-scrollbar-thumb:hover {
  background: rgba(186, 198, 216, 0.55);
  background-clip: padding-box;
}

@keyframes flow {
  0% {
    stroke-dashoffset: 24;
  }
  100% {
    stroke-dashoffset: 0;
  }
}
.edge-anim {
  stroke-dasharray: 8 4;
  animation: flow 1.2s linear infinite;
}

#modal-root.flex {
  display: flex;
}

.modal-panel {
  pointer-events: auto;
}

.toast-item {
  pointer-events: auto;
  animation: toast-in 0.35s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.donut-ring {
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(94, 234, 212, 0.45);
  outline-offset: 2px;
}
