/* ==========================================================================
   Layout · 应用外壳 / 侧栏 / 顶栏 / 移动端导航 / 登录注册布局
   ========================================================================== */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── 侧栏 ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 14px;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: none;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.3;
  margin-top: 1px;
  letter-spacing: 0.02em;
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label {
  padding: 14px 9px 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 35px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.nav-item svg { width: 16px; height: 16px; opacity: 0.85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
}
.nav-item.is-active svg { opacity: 1; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-faint);
  background: var(--surface-2);
  min-width: 0;
}
.user-card .meta { min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.user-role { font-size: 10.5px; color: var(--text-3); line-height: 1.3; }

.side-actions { display: flex; gap: 4px; }
.side-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  flex: 1;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 12px;
  transition: background-color 0.12s, color 0.12s;
}
.side-action:hover { background: var(--surface-3); color: var(--text); }
.side-action svg { width: 14px; height: 14px; }

/* ── 主区域 ───────────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--text);
  min-width: 0;
}
.topbar-title .crumb { color: var(--text-3); font-weight: 500; }
.topbar-title .sep { color: var(--border-strong); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-menu { display: none; }

.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 26px 28px 72px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 页头 */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-top: 4px;
}
.page-head-main { min-width: 0; }
.page-head h1 {
  font-size: 23px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.025em;
}
.page-head p { margin-top: 5px; font-size: 13px; color: var(--text-2); }
.page-head-actions { display: flex; gap: 8px; align-items: center; flex: none; }

/* 面包屑 */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }

/* 跳转链接（键盘可见） */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 300;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 13px;
  font-weight: 550;
  transform: translateY(-160%);
  transition: transform 0.15s var(--ease);
}
.skip-link:focus {
  transform: none;
  color: var(--on-primary);
}

/* ── 移动端底部导航 ───────────────────────────────────────────────────── */
.bottom-nav { display: none; }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(10, 12, 16, 0.4);
  backdrop-filter: blur(2px);
  animation: fade 0.16s var(--ease);
}

/* ── 登录 / 注册 ──────────────────────────────────────────────────────── */
.auth {
  display: grid;
  grid-template-columns: minmax(380px, 46%) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 34px 40px 30px;
  overflow: hidden;
  color: #f2f4f8;
  background-color: #11141a;
  background-image:
    radial-gradient(900px 420px at 12% 0%, rgba(81, 105, 255, 0.22), transparent 62%),
    radial-gradient(520px 380px at 92% 96%, rgba(255, 255, 255, 0.06), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0);
  background-size: auto, auto, 22px 22px;
}
:root[data-theme="sand"] .auth-aside {
  background-color: #241d15;
  background-image:
    radial-gradient(900px 420px at 12% 0%, rgba(196, 138, 58, 0.28), transparent 62%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0);
  background-size: auto, 22px 22px;
}
:root[data-theme="night"] .auth-aside { background-color: #0c0f14; }

.auth-aside .brand { color: #fff; padding: 0 0 0; }
.auth-aside .brand-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  flex: none;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.auth-aside .brand-sub { color: rgba(255, 255, 255, 0.5); }
.auth-aside-body { margin-top: auto; margin-bottom: auto; padding: 40px 0; max-width: 420px; }
.auth-aside h2 {
  font-size: 30px;
  line-height: 1.32;
  font-weight: 620;
  letter-spacing: -0.03em;
  margin-top: 14px;
}
.auth-aside h2 em { font-style: normal; color: rgba(255, 255, 255, 0.62); }
.auth-aside .lead { margin-top: 12px; color: rgba(255, 255, 255, 0.56); font-size: 13.5px; }
.auth-points { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-point { display: flex; gap: 11px; align-items: flex-start; }
.auth-point-icon {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  flex: none;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  margin-top: 1px;
}
.auth-point-icon svg { width: 14px; height: 14px; }
.auth-point-title { font-size: 13px; font-weight: 560; color: rgba(255, 255, 255, 0.92); }
.auth-point-desc { font-size: 12px; color: rgba(255, 255, 255, 0.46); line-height: 1.55; margin-top: 1px; }
.auth-aside-foot { font-size: 11px; color: rgba(255, 255, 255, 0.35); letter-spacing: 0.02em; }

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background: var(--surface);
}
.auth-card { width: 100%; max-width: 374px; }
.auth-head { margin-bottom: 22px; }
.auth-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.025em; }
.auth-head p { margin-top: 5px; font-size: 13px; color: var(--text-2); }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-foot {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
}
.auth-foot a { font-weight: 560; }
.auth-mobile-brand { display: none; }

/* 注册页：人机验证 / 分隔线 / QQ 标记 */
.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-question {
  flex: none;
  min-width: 104px;
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.captcha-row .input { flex: 1; min-width: 0; }
.captcha-refresh { flex: none; width: 38px; height: 38px; padding: 0; }
.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -1px 0;
  font-size: 11.5px;
  color: var(--text-3);
}
.auth-or::before,
.auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.qq-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ── 响应式 ───────────────────────────────────────────────────────────── */

/* 1024 档：收窄留白 */
@media (max-width: 1200px) {
  :root { --sidebar-w: 224px; }
  .content { padding: 22px 22px 64px; }
  .topbar { padding: 0 22px; }
  .auth-aside { padding: 30px 32px 26px; }
}

/* ≤900：侧栏变抽屉 + 底部 Tab */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 272px;
    max-width: 84vw;
    transform: translateX(-102%);
    transition: transform 0.24s var(--ease);
    box-shadow: var(--sh-lg);
    border-right: 1px solid var(--border);
  }
  .app.is-nav-open .sidebar { transform: none; }
  .app.is-nav-open .scrim { display: block; }

  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    margin-left: -4px;
    border-radius: var(--r-sm);
    color: var(--text-2);
  }
  .topbar-menu:hover { background: var(--surface-3); }
  .topbar-menu svg { width: 18px; height: 18px; }
  .topbar-actions .btn span.hide-sm { display: none; }

  .content {
    padding: 18px 14px calc(84px + env(safe-area-inset-bottom));
    gap: 16px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-head h1 { font-size: 20px; }
  .page-head-actions { overflow-x: auto; padding-bottom: 2px; }
  .page-head-actions .btn { flex: none; }

  /* 底部导航 */
  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 35;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px 4px 3px;
    border-radius: var(--r-sm);
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 500;
  }
  .bottom-nav-item svg { width: 19px; height: 19px; }
  .bottom-nav-item.is-active { color: var(--text); font-weight: 600; }

  /* 登录页：隐藏左栏，顶部显示品牌 */
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-main { justify-content: flex-start; padding: 34px 22px 48px; }
  .auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 32px;
  }
  .auth-card { max-width: 420px; margin: 0 auto; }
}

@media (max-width: 560px) {
  .content { padding-left: 13px; padding-right: 13px; }
  .card-body { padding: 15px; }
  .card-head { padding: 14px 15px; }
  .page-head h1 { font-size: 19px; }
  .stat { padding: 14px 15px; }
  .stat-value { font-size: 25px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .overlay { padding: 14px; align-items: flex-end; }
  .modal { max-height: calc(100dvh - 40px); }
  .toast-host { top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; left: 12px; max-width: none; }
  .toast { animation: toast-in-up 0.18s var(--ease); }
  @keyframes toast-in-up { from { opacity: 0; transform: translateY(8px); } }
}

/* 强制改密：常驻提醒入口（侧栏 + 顶栏） */
.nav-item-warn { color: var(--warn); }
.nav-item-warn:hover { background: var(--warn-soft); color: var(--warn); }
.nav-item-warn svg { opacity: 1; }
.nav-dot {
  margin-left: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}
.topbar-reminder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}
.topbar-reminder:hover { border-color: var(--warn); }
.topbar-reminder svg { width: 14px; height: 14px; }
@media (max-width: 620px) {
  .topbar-reminder { width: 30px; padding: 0; justify-content: center; }
  .topbar-reminder span { display: none; }
}

/* 品牌图标（2026-11-23 换成黄闹钟 PNG） */
.brand-mark-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
