/* ============================================================
   企业管理系统 · Nothing-inspired 白紫工作台
   白底 + 紫色强调 + 点阵母题 + 等宽微标签 + 大号标题
   参考：E:\personal agent\app\web\style.css
   ============================================================ */

:root {
  color-scheme: light;

  --paper: #fafafa;
  --surface: #ffffff;
  --surface-sunken: #f4f4f5;
  --ink: #0a0a0a;
  --ink-soft: #52525b;
  --ink-faint: #a1a1aa;
  --line: #ececee;
  --line-strong: #dcdce0;

  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: #a78bfa;
  --accent-wash: #f3effe;
  --accent-glow: rgba(124, 58, 237, 0.16);

  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --ok-soft: #ecfdf3;
  --warn-soft: #fff8eb;
  --danger-soft: #fef2f2;

  --font-display: "Space Grotesk", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas, monospace;

  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.04);
  --shadow-md: 0 10px 34px rgba(10, 10, 10, 0.07);
  --shadow-accent: 0 12px 34px var(--accent-glow);

  --sidebar-w: 244px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* 兼容旧组件变量 */
  --bg: var(--paper);
  --muted: var(--ink-soft);
  --primary: var(--accent);
  --primary-dark: var(--accent-strong);
  --primary-soft: var(--accent-wash);
  --sidebar: var(--surface);
  --sidebar-soft: var(--surface-sunken);
  --radius: var(--r-lg);
  --shadow: var(--shadow-md);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 点阵底纹，只露右上角 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.35;
  mask-image: radial-gradient(circle at 74% 4%, #000 0%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle at 74% 4%, #000 0%, transparent 62%);
}

::selection { background: var(--accent-soft); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
html { scroll-behavior: smooth; scrollbar-color: #d4d4d8 var(--paper); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 8px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: #bdbdc4; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
em { font-style: normal; color: var(--accent); }

button, input, select, textarea { font-family: inherit; font-size: 14px; }

.mono, .eyebrow {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.eyebrow { display: inline-block; font-size: 10.5px; color: var(--ink-faint); }
.muted { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }
.sub { display: block; margin-top: 3px; color: var(--ink-faint); font-size: 11.5px; font-weight: 400; }

/* ============================== 侧栏 ============================== */
body.app { min-height: 100vh; }
.shell { position: relative; z-index: 1; }

.mask {
  display: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px 18px;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: var(--accent);
  filter: drop-shadow(0 3px 8px var(--accent-glow));
}
.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
  white-space: nowrap;
}
.brand-text small {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-title {
  margin: 26px 0 8px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: var(--ink-soft);
  font-size: 15.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex: none; transition: transform 0.25s var(--ease); }
.nav-item:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-item:hover svg { transform: scale(1.06) rotate(-3deg); }
.nav-item.active { background: var(--accent-wash); color: var(--accent-strong); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 17px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item.active svg { filter: drop-shadow(0 2px 5px var(--accent-glow)); }

.nav-badge {
  margin-left: auto;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  display: grid;
  place-items: center;
}
.nav-item.active .nav-badge { background: var(--accent-strong); }

.sidebar-bottom {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.me:hover {
  border-color: var(--accent-soft);
  background: var(--accent-wash);
  color: var(--ink);
}
.avatar {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
.avatar.lg { width: 52px; height: 52px; flex-basis: 52px; font-size: 18px; }
.me-text { min-width: 0; }
.me-text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-text span { display: block; font-size: 10.5px; color: var(--ink-faint); }

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--ink-soft);
  font-size: 11px;
}
.status-dot {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ink-faint);
}
.status-dot.is-live { background: var(--ok); animation: dot-pulse 2.2s infinite; }
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 5px transparent; }
}
.sidebar-version {
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

/* ============================== 主区 / 顶部 ============================== */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 34px clamp(22px, 4vw, 52px) 60px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.topbar-title h1 {
  margin-top: 8px;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.topbar-title p { margin: 8px 0 0; color: var(--ink-soft); font-size: 13.5px; }

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.env-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

/* ---------- 顶部模块导航 ---------- */
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}
.topnav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.topnav-item:hover { background: var(--surface-sunken); color: var(--ink); }
.topnav-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.content { display: flex; flex-direction: column; gap: 18px; }
.main-footer {
  margin-top: auto;
  padding-top: 34px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }

/* ============================== 通用组件 ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
              color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-glow); }
.btn.primary:hover { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow-accent); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn.ghost:hover { border-color: var(--accent-soft); color: var(--accent-strong); background: var(--accent-wash); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-pill); }
.btn.xs { min-height: 27px; padding: 0 10px; font-size: 11.5px; border-radius: var(--r-pill); }
.btn.disabled { opacity: 0.45; pointer-events: none; }
.sidebar .btn.ghost {
  min-height: 34px;
  border-color: var(--line);
  color: var(--ink-soft);
  background: transparent;
  font-weight: 500;
  font-size: 12px;
}
.sidebar .btn.ghost:hover { background: var(--accent-wash); color: var(--accent-strong); border-color: var(--accent-soft); }

.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.flash-stack.floating {
  position: fixed;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(92vw, 460px);
  margin: 0;
}
.flash {
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  animation: flash-in 0.3s var(--ease) both;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash.success { background: var(--ok-soft); border-color: #d3f0df; border-left-color: var(--ok); color: #067647; }
.flash.error { background: var(--danger-soft); border-color: #fbd5d5; border-left-color: var(--danger); color: #b42318; }
.flash.info { background: var(--accent-wash); border-color: #e3d8fd; border-left-color: var(--accent); color: var(--accent-strong); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); border-color: transparent; color: #067647; }
.badge.warn { background: var(--warn-soft); border-color: transparent; color: #b45309; }
.badge.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.badge.muted { background: var(--surface-sunken); border-color: transparent; color: var(--ink-faint); }
.badge.accent { background: var(--accent-wash); border-color: transparent; color: var(--accent-strong); }

.tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.tag.strong { background: var(--accent); color: #fff; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.panel-head h3 { font-size: 17px; letter-spacing: -0.02em; }
.panel-head .muted { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.panel-head.section-gap { margin-top: 24px; }

/* 数据库表结构：默认收起，点击标题展开（三角符号指示） */
.struct-head { cursor: pointer; user-select: none; }
.struct-head:hover h3 { color: var(--accent-strong); }
.struct-tri { display: inline-block; width: 16px; margin-right: 4px; color: var(--ink-faint); font-size: 13px; }

/* 侧边栏品牌与导航之间留出呼吸空间 */
.sidebar .brand { margin-bottom: 28px; }

/* ============================== 表单 ============================== */
.form { display: flex; flex-direction: column; gap: 16px; }

/* 系统设置：所有分区与保存按钮统一放在一个外框中 */
.settings-panel .form { gap: 0; }
.settings-block + .settings-block {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}
.settings-panel .form-actions {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px dashed var(--line);
}

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.field > span em { color: var(--accent); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
.field textarea { line-height: 1.7; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-wash);
}
.field input:disabled { background: var(--surface-sunken); color: var(--ink-faint); }
.field small { color: var(--ink-faint); font-size: 10.5px; font-family: var(--font-mono); }
.field input[type="file"] {
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--paper);
}
.field input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field.full { grid-column: 1 / -1; }
.check-field { flex-direction: row; align-items: center; gap: 9px; align-self: end; padding-bottom: 10px; }
.check-field input { width: auto; min-height: 0; accent-color: var(--accent); }
.check-field span { font-size: 12.5px; }

.input, .select {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  min-width: 0;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}
.input:focus, .select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-wash);
}
.input.sm, .select.sm { min-height: 30px; padding: 4px 9px; font-size: 12px; border-radius: var(--r-sm); }
.input.wide { flex: 1; min-width: 180px; }

.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.filter-bar .input { min-width: 190px; }
.filter-bar .input.wide { flex: 1 1 200px; min-width: 200px; }
.filter-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.form-actions { display: flex; gap: 10px; align-items: center; }
.page-back { margin-bottom: 2px; }
.link {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}
.link:hover { color: var(--accent-strong); text-decoration: underline; }
.link.danger { color: var(--danger); }
.link.danger:hover { color: #b91c1c; }

.notice {
  padding: 12px 15px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 1.7;
  border: 1px solid transparent;
}
.notice.info { background: var(--accent-wash); border-color: #e4d8fd; color: #4c1d95; }

/* ============================== 表格 ============================== */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 11px 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  vertical-align: middle;
}
.table tbody tr { transition: background 0.14s var(--ease); }
.table tbody tr:hover { background: var(--accent-wash); }
.col-actions { width: 1%; white-space: nowrap; }
.empty-cell { text-align: center; color: var(--ink-faint); padding: 28px 0; font-size: 12.5px; }
.db-path {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  word-break: break-all;
}
.db-value {
  max-width: 360px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}
.audit-table td.ellipsis { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Excel 风格数据表：表头加大、单元格全框线、双击编辑 */
.excel-table th {
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  text-align: center;
  vertical-align: middle;
}
.excel-table td { text-align: left; }
.excel-table .excel-row-no {
  width: 48px;
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--surface-sunken);
}
.excel-col-cn { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.excel-col-code {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
}
.excel-cell { min-width: 96px; }
.excel-cell.is-editable { cursor: cell; }
.excel-cell.is-editable:hover { background: #fffbea; }
.excel-cell.is-saving { background: #eef6ff; }
.excel-cell.is-error { background: #fdecec; }
.excel-editor {
  width: 100%;
  min-width: 80px;
  padding: 2px 6px;
  border: 2px solid #2563eb;
  border-radius: 3px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.db-save-state { margin-left: auto; font-size: 12px; color: var(--ink-faint); }
.db-save-state.ok { color: #15803d; }
.db-save-state.bad { color: #b91c1c; }


.cell-user { display: flex; align-items: center; gap: 9px; }
.cell-user.is-link { color: inherit; }
.cell-user.is-link:hover strong { color: var(--accent); text-decoration: underline; }
.cell-user strong { display: block; font-size: 13px; font-weight: 600; }
.cell-user small { display: block; color: var(--ink-faint); font-size: 10.5px; font-family: var(--font-mono); }

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: max-content;
}
.action-stack { display: flex; flex-direction: column; gap: 8px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }

.empty-box {
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--paper);
}
.empty-box p { margin: 0 0 4px; font-weight: 600; font-family: var(--font-display); }
.empty-box .muted { font-size: 12px; }

/* ============================== 工作台 ============================== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 36px;
  align-items: start;
  padding: 6px 0 30px;
  border-bottom: 1px solid var(--line);
}
.hero-main { min-width: 0; }
.hero-tag { display: inline-block; margin-bottom: 12px; }
.hero h2 {
  font-size: clamp(36px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0;
}
.hero p { margin: 16px 0 0; max-width: 620px; color: var(--ink-soft); font-size: 14px; line-height: 1.8; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.hero-signal {
  position: relative;
  height: 200px;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.hero-signal::before {
  content: "";
  position: absolute;
  inset: 8px;
  background-image: radial-gradient(var(--accent-soft) 1px, transparent 1.2px);
  background-size: 9px 9px;
  opacity: 0.22;
  border-radius: 50%;
  mask-image: radial-gradient(circle, #000 12%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 70%);
}
.signal-ring {
  width: 150px; height: 150px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle at 35% 30%, #fff, #f8f6ff);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.8), 0 20px 50px rgba(10, 10, 10, 0.06);
  display: grid;
  place-items: center;
  position: relative;
}
.signal-ring::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px dashed var(--accent-soft);
  opacity: 0.6;
}
.signal-core {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 10px var(--accent-wash), 0 8px 20px var(--accent-glow);
}
.signal-label {
  position: absolute;
  bottom: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.hero-side {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.hero-user { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hero-user strong { display: block; font-size: 13.5px; }
.hero-user span { display: block; font-size: 11.5px; color: var(--ink-faint); }
.hero-list { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.hero-list > div { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.hero-list dt { color: var(--ink-faint); }
.hero-list dd { margin: 0; color: var(--ink); text-align: right; }

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px 22px 18px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  min-width: 0;
}
.metric:last-child { border-right: none; }
.metric:hover { background: var(--accent-wash); }
.metric__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.metric__value {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.metric--accent .metric__value { color: var(--accent); }
.metric__hint { margin-top: 3px; font-size: 11px; color: var(--ink-soft); }

.perm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.chip.strong { background: var(--accent-wash); color: var(--accent-strong); }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.module-card:hover { transform: translateY(-3px); border-color: var(--accent-soft); box-shadow: var(--shadow-accent); }
.module-card.ready .module-icon { background: var(--accent-wash); color: var(--accent-strong); }
.module-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.module-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--surface-sunken);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}
.module-card h3 { font-size: 16px; margin-bottom: 5px; }
.module-card p { margin: 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.7; flex: 1; }
.module-links { display: flex; gap: 14px; margin-top: 14px; }
.module-links a { font-size: 11.5px; font-weight: 500; }
.module-card.placeholder { background: var(--paper); border-style: dashed; box-shadow: none; }

/* ============================== 管理细节 ============================== */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 18px; }

/* 编辑用户：左侧基本信息与右侧「重置密码 + 账号状态」总高度对齐 */
.user-edit-layout { align-items: stretch; }
.basic-info-panel { display: flex; flex-direction: column; }
.basic-info-panel > .form { flex: 1; display: flex; flex-direction: column; }
.basic-info-panel .field-grid {
  flex: 1;
  align-content: space-between;
  gap: 26px 20px;
}

.meta-list { margin: 0 0 16px; display: flex; flex-direction: column; gap: 9px; }
.meta-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.meta-list dt { color: var(--ink-faint); }
.meta-list dd { margin: 0; text-align: right; font-family: var(--font-mono); font-size: 11.5px; }

.perm-groups { display: flex; flex-direction: column; gap: 14px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.perm-group-head {
  padding: 10px 14px;
  background: var(--accent-wash);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--accent-strong);
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}
.perm-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 10px 12px; }
.perm-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  transition: background 0.14s var(--ease);
}
.perm-item:hover { background: var(--accent-wash); }
.perm-item.disabled { opacity: 0.7; }
.perm-item input { width: 15px; height: 15px; accent-color: var(--accent); }
.perm-name { font-size: 12.5px; }
.perm-code {
  margin-left: auto;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

.step-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================== 登录 / 注册 ============================== */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 20px;
  background: var(--paper);
}

.auth-layout {
  width: min(1000px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.auth-layout.single {
  width: min(460px, 100%);
  grid-template-columns: 1fr;
  gap: 0;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 34px 34px 28px;
  box-shadow: var(--shadow-md);
}
.auth-panel-title { font-size: 23px; letter-spacing: -0.025em; }
.auth-panel-desc { margin: 6px 0 22px; color: var(--ink-soft); font-size: 12.5px; }
.auth-panel .form { margin-bottom: 16px; }
.auth-panel .btn.primary { min-height: 44px; }

.auth-switch { text-align: center; margin: 4px 0 0; color: var(--ink-faint); font-size: 12px; }
.auth-tips {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-align: center;
}

.auth-single {
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 36px 42px 32px;
  box-shadow: var(--shadow-md);
}
.auth-single .brand { padding: 0; margin-bottom: 28px; }
.auth-single h1 {
  font-size: clamp(30px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.auth-single .lead { margin: 0 0 22px; color: var(--ink-soft); font-size: 12.5px; line-height: 1.7; }
.auth-single.center { text-align: center; }
.auth-single.center .brand { justify-content: center; }

.status-icon {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 18px;
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 0 0 9px var(--accent-wash);
}
.status-icon.error { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 9px var(--danger-soft); }

.button-row { display: flex; gap: 10px; margin-top: 20px; }
.button-row.center { justify-content: center; }

.steps { list-style: none; padding: 0; margin: 22px 0; display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-faint); }
.steps li span {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-sunken);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}
.steps li.done { color: var(--ink-soft); }
.steps li.done span { background: var(--ok-soft); color: var(--ok); }
.steps li.current { color: var(--accent-strong); font-weight: 600; }
.steps li.current span { background: var(--accent); color: #fff; }

/* ============================== 响应式 ============================== */
@media (max-width: 1080px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; }
  .signal-ring { width: 128px; height: 128px; }
  .perm-items { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; gap: 22px; max-width: 620px; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.24s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 10, 10, 0.38);
    backdrop-filter: blur(2px);
  }
  .mask.show { display: block; }
  .main { margin-left: 0; padding: 22px 18px 44px; }
  .icon-btn { display: inline-flex; }
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .topbar-title h1 { font-size: 28px; }
  .env-pill { display: none; }
  .two-col { grid-template-columns: 1fr; }
  .auth-layout { padding: 10px 0; }
  .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .filter-count { margin-left: 0; }
  .audit-table td.ellipsis { max-width: 160px; }
  .hero { grid-template-columns: 1fr; }
  .hero-signal { display: none; }
  .topnav { width: 100%; }
  .topnav-item { padding: 6px 12px; font-size: 14px; }
}

@media (max-width: 700px) {
  .stack-mobile, .stack-mobile tbody, .stack-mobile tr, .stack-mobile td {
    display: block;
    width: 100%;
  }
  .stack-mobile thead { display: none; }
  .stack-mobile tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 11px 14px;
    margin-bottom: 12px;
    background: var(--surface);
    height: auto;
  }
  .stack-mobile tbody tr:hover { background: var(--surface); }
  .stack-mobile tbody tr:last-child { margin-bottom: 0; }
  .stack-mobile td { border: none; padding: 3px 0; }
  .stack-mobile td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 1px;
  }
  .stack-mobile td[data-label=""]::before { content: none; }
  .stack-mobile td[data-label=""] .action-row,
  .stack-mobile td[data-label="审核操作"] .action-stack {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
  }
  .stack-mobile td.ellipsis,
  .stack-mobile .audit-table td.ellipsis {
    max-width: none;
    white-space: normal;
    overflow: visible;
  }
  .stack-mobile .cell-user { margin-bottom: 2px; }
  .stack-mobile .empty-cell { display: block; }
}

@media (max-width: 600px) {
  .auth-panel, .auth-single { padding: 26px 22px 24px; border-radius: var(--r-lg); }
  .hero h2 { font-size: 36px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2n) { border-right: none; }
  .metric { padding: 16px 16px 14px; }
  .metric__value { font-size: 26px; }
  .panel { padding: 16px; border-radius: var(--r-lg); }
  .main { padding: 20px 14px 36px; }
  .topbar-title h1 { font-size: 26px; }
  .button-row { flex-direction: column; }
  .pager { flex-wrap: wrap; }
}
