/* =========================================================================
   Jev2Api · 基础层：重置 / 环境背景 / 顶栏 / 侧边栏区域 / 布局 / 间距
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text-1);
  font-family: "Rubik", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  overflow: hidden;                    /* 页面本身不滚动，滚动发生在主内容区 */
  transition: background .3s, color .3s;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; color: var(--code); }

/* ---------- 苹果风极简滚动条（细、圆、平时几乎隐形） ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: 999px;
  border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover); background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

:root {
  --r-card: 20px; --r-bento: 30px; --r-panel: 22px;
  --side-w: 226px; --side-w-collapsed: 74px;
  /* 区域间距：所有区块之间统一走这三个变量 */
  --gap-page: 20px;      /* 视图内各大区域之间 */
  --gap-block: 14px;     /* 卡片内部块之间 */
  --pad-card: 18px;      /* 卡片内边距 */
}

/* ---------- 环境光 / 底纹 ---------- */
.glow { position: fixed; border-radius: 50%; filter: blur(120px); opacity: var(--glow-opacity);
  pointer-events: none; z-index: 0; transition: background .3s, opacity .3s; }
.glow--a { width: 680px; height: 680px; top: -300px; left: -180px; background: var(--bg-grad-a); }
.glow--b { width: 560px; height: 560px; bottom: -280px; right: -140px; background: var(--bg-grad-b); }
.grid-bg {
  position: fixed; inset: 0; z-index: 0; opacity: .55; pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: var(--grid-mask); mask-image: var(--grid-mask);
}

/* ---------- 图标 / 小按钮 ---------- */
.ic { width: 18px; height: 18px; flex: none; display: block; }
.ic--sm { width: 14px; height: 14px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  color: var(--text-2); border: 1px solid transparent; transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--surface-hover); color: var(--text-1); }

/* ---------- 顶栏：居中悬浮「胶囊」（Dock 感，不再通栏） ---------- */
.topbar {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 60;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  /* 固定宽度：所有页面一致，约占视口 55%（下限 520 / 上限 1040） */
  width: clamp(520px, 55vw, 1040px);
  padding: 7px 9px 7px 15px; min-height: 52px;
  border-radius: 999px;
  background: var(--dock-bg);
  border: 1px solid var(--dock-border);
  box-shadow: var(--dock-shadow);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
.topbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.badge {
  display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px;
  background: var(--grad); font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: #fff; flex: none;
}
.crumb { min-width: 0; display: flex; align-items: baseline; gap: 9px; }
.crumb__t { font-size: 15px; font-weight: 500; letter-spacing: .01em; white-space: nowrap;
  flex: none; }
.crumb__d { font-size: 11.5px; color: var(--text-4); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 300px; }
.crumb__s { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 264px; }

.pills { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 1280px) { .pills { display: none; } }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-soft);
  border: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); white-space: nowrap;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.pill b { font-weight: 600; color: var(--text-1); }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); display: inline-block; }
.pill--ok { border-color: var(--ok-line); } .pill--ok i { background: var(--ok); }
.pill--warn { border-color: var(--warn-line); } .pill--warn i { background: var(--warn); }
.pill--err { border-color: var(--err-line); } .pill--err i { background: var(--err); }

/* ---------- 管理员菜单 / 主题切换 ---------- */
.menu-wrap { position: relative; }
.adminchip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 6px;
  border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border);
  transition: background .15s;
}
.adminchip:hover { background: var(--surface-hover); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); font-size: 11.5px; font-weight: 600; color: #fff; flex: none;
}
.adminchip__t { font-size: 12.5px; color: var(--text-1); max-width: 120px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.dropdown {
  position: absolute; top: 42px; right: 0; min-width: 236px; padding: 6px; z-index: 90;
  background: var(--surface-menu); border: 1px solid var(--border-strong); border-radius: 16px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--menu-shadow);
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .16s, transform .16s;
}
.dropdown.show { opacity: 1; transform: none; pointer-events: auto; }
.dropdown__head { padding: 9px 11px 11px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown__name { font-size: 13.5px; color: var(--text-1); }
.dropdown__role { font-size: 11.5px; color: var(--text-3); }
.dropdown__item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  text-align: left; padding: 9px 11px; border-radius: 10px; font-size: 13px; color: var(--text-2);
}
.dropdown__item:hover { background: var(--surface-hover); color: var(--text-1); }
.dropdown__item--danger { color: var(--err-text); }
.dropdown__item--danger:hover { background: var(--err-soft); }
.dropdown__sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown__meta { font-size: 11px; color: var(--text-4); }

/* ---------- 布局 ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: var(--gap-page);
  height: 100vh; height: 100dvh;
  max-width: 2000px; margin: 0 auto;   /* 宽屏不被过度拉伸；常规屏即靠左贴边 */
  padding: 84px 16px 16px 12px;        /* 顶部给悬浮胶囊让位；左侧只留一点间距 */
  align-items: stretch;
  transition: grid-template-columns .28s cubic-bezier(.4, 0, .2, 1);
}
body.side-collapsed .layout { grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr); }

/* ---------- 侧边栏（独立区域卡片，折叠按钮在区域内） ---------- */
.side { height: 100%; min-height: 0; }
.side__panel {
  position: relative; display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  padding: 10px;
  border-radius: var(--r-panel);
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--card-shadow);
  transition: padding .28s cubic-bezier(.4, 0, .2, 1);
}
.side__panel::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 1.5px solid var(--border-soft);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 82%);
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}
.side__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 3px 4px 9px; margin-bottom: 8px; border-bottom: 1px solid var(--border-soft);
}
.side__brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3);
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  transition: opacity .18s ease, max-width .28s cubic-bezier(.4, 0, .2, 1);
  max-width: 160px; overflow: hidden; white-space: nowrap; }
.side__toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; color: var(--text-3);
  border: 1px solid transparent; flex: none;
  transition: background .15s, color .15s, border-color .15s;
}
.side__toggle:hover { background: var(--surface-hover); color: var(--text-1);
  border-color: var(--border-strong); }
.side__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 图标方向：展开态箭头朝左（收起），折叠态旋转 180° 箭头朝右（展开） */
.side__chev { width: 17px; height: 17px;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1); }
.side__nav { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; padding: 2px; }
.side__nav::-webkit-scrollbar { width: 6px; }
.side__group {
  padding-left: 11px; font-size: 10px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-4);
  max-height: 30px; margin: 12px 0 5px; overflow: hidden;
  transition: opacity .16s ease, max-height .28s cubic-bezier(.4, 0, .2, 1),
              margin .28s cubic-bezier(.4, 0, .2, 1), padding .28s cubic-bezier(.4, 0, .2, 1);
}
.side__nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 11px;
  font-size: 13px; color: var(--text-2); border: 0;
  transition: background .18s cubic-bezier(.4, 0, .2, 1), color .18s,
              transform .13s cubic-bezier(.4, 0, .2, 1);
}
.side__nav a .ic { opacity: .72; transition: opacity .18s, color .18s; }
.side__nav a:hover .ic { opacity: .92; }
.side__nav a:active { transform: scale(.985); }
.side__nav a span {
  max-width: 160px; overflow: hidden; white-space: nowrap;
  transition: opacity .18s ease, max-width .28s cubic-bezier(.4, 0, .2, 1);
}
.side__nav a:hover { background: var(--surface-soft); color: var(--text-1); }
.side__nav a.active {
  background: var(--accent-soft);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}
.side__nav a.active .ic { opacity: 1; color: var(--accent-text); }
/* 折叠态：用 opacity + max-width/max-height 过渡（不能用 display:none，否则没有动效） */
body.side-collapsed .side__panel { padding: 10px 8px; }
body.side-collapsed .side__head { justify-content: center; padding: 3px 0 9px; }
body.side-collapsed .side__brand { opacity: 0; max-width: 0; }
body.side-collapsed .side__nav a { justify-content: center; padding: 9px 0; gap: 0; }
body.side-collapsed .side__nav a span { opacity: 0; max-width: 0; }
body.side-collapsed .side__group { opacity: 0; max-height: 0; margin: 0; padding-left: 0; }
body.side-collapsed .side__chev { transform: rotate(180deg); }

@media (max-width: 1080px) {
  /* 窄屏：回归普通文档流滚动（侧栏折到顶部横排） */
  html, body { height: auto; overflow: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 100vh;
    padding-bottom: 40px; }
  body.side-collapsed .layout { grid-template-columns: minmax(0, 1fr); }
  .side { height: auto; }
  .side__panel { height: auto; min-height: 0; padding: 10px; }
  .side__nav { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .side__group, .side__head { display: none; }
  .main { height: auto; overflow: visible; }
  body.side-collapsed .side__nav a span { opacity: 1; max-width: 160px; }
  body.side-collapsed .side__nav a { justify-content: flex-start; padding: 9px 11px; }
}

/* 尊重系统「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  .layout, .side__panel, .side__brand, .side__group,
  .side__nav a span, .side__chev { transition: none !important; }
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- 主区 / 视图区域间距 ---------- */
.main { min-width: 0; height: 100%; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; }             /* 页面级滚动条隐藏（滚轮/触控板仍可滚动） */
.main::-webkit-scrollbar { width: 0; height: 0; display: none; }
.view { display: flex; flex-direction: column; gap: var(--gap-page); min-height: 100%; }

/* ---------- 工具条（页面顶部操作区，替代冗余标题） ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border-soft);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--card-shadow);
}
.toolbar__grow { flex: 1 1 auto; }
.toolbar__label { font-size: 12.5px; color: var(--text-3); }
.toolbar .input { min-width: 130px; }

/* ---------- 网格 ---------- */
.grid { display: grid; gap: var(--gap-block); }
.grid--hero { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--two { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.grid--pg { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 1180px) {
  .grid--hero, .grid--stats, .grid--two, .grid--pg { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 右上角通知 ---------- */
.notices {
  position: fixed; top: 82px; right: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 9px;
  width: min(370px, calc(100vw - 32px)); pointer-events: none;
}
.notice {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border-radius: 14px;
  background: var(--surface-menu); border: 1px solid var(--border-strong);
  box-shadow: var(--menu-shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  opacity: 0; transform: translateX(16px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
}
.notice.in { opacity: 1; transform: none; }
.notice__ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice__body { flex: 1; min-width: 0; }
.notice__title { font-size: 12.5px; font-weight: 600; color: var(--text-1); margin-bottom: 1px; }
.notice__msg { font-size: 12.5px; color: var(--text-2); line-height: 1.5; word-break: break-word; }
.notice__x { color: var(--text-4); padding: 2px; border-radius: 6px; flex: none; }
.notice__x:hover { background: var(--surface-hover); color: var(--text-1); }
.notice--ok { border-color: var(--ok-line); }
.notice--ok .notice__ic { color: var(--ok); }
.notice--err { border-color: var(--err-line); }
.notice--err .notice__ic { color: var(--err); }
.notice--warn { border-color: var(--warn-line); }
.notice--warn .notice__ic { color: var(--warn); }
.notice--info .notice__ic { color: var(--accent); }
@media (max-width: 720px) { .notices { top: auto; bottom: 16px; right: 12px; left: 12px; width: auto; } }

/* ---------- 确认弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; }
.modal__mask { position: absolute; inset: 0; background: var(--mask-bg);
  backdrop-filter: blur(2px); opacity: 0; transition: opacity .18s; }
.modal.in .modal__mask { opacity: 1; }
.modal__box {
  position: relative; width: min(440px, calc(100vw - 40px));
  padding: 18px 20px 16px; border-radius: 20px;
  background: var(--surface-menu); border: 1px solid var(--border-strong);
  box-shadow: var(--menu-shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  opacity: 0; transform: translateY(10px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}
.modal.in .modal__box { opacity: 1; transform: none; }
.modal__head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.modal__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.modal__box--danger .modal__dot { background: var(--err); }
.modal__title { font-size: 14.5px; font-weight: 600; color: var(--text-1); }
.modal__msg { font-size: 13px; color: var(--text-2); line-height: 1.65; }
.modal__detail { margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; background: var(--log-bg);
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 11.5px; color: var(--text-3);
  max-height: 160px; overflow: auto; white-space: pre-wrap; }
.modal__acts { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
