/* =========================================================
   党员发展流程动态管理系统 · shadcn/ui 风格设计系统
   白底 + 红色主色 · 中性灰边框 · 轻阴影
   ========================================================= */
:root {
  --background: #f3f3f5;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #52525b;
  --subtle: #71717a;
  --border: #d9d9df;
  --border-soft: #e8e8ec;
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --primary-dark: #991b1b;
  --primary-soft: #fef2f2;
  --primary-border: #fecaca;
  --ring: rgba(220, 38, 38, 0.16);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(9, 9, 11, 0.06);
  --shadow-sm: 0 1px 3px rgba(9, 9, 11, 0.08), 0 1px 2px rgba(9, 9, 11, 0.05);
  --shadow-md: 0 10px 32px rgba(9, 9, 11, 0.12);
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--foreground); }
svg { flex-shrink: 0; }

.hidden { display: none !important; }
.muted { color: var(--muted-foreground); }
.dash { color: var(--subtle); }
.wrap-text { white-space: normal; word-break: break-all; min-width: 150px; }
.placeholder { color: var(--subtle); }

::selection { background: #fecaca; color: #7f1d1d; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 999px; border: 3px solid var(--background); }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }

/* =========================================================
   Shell
   ========================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.brand-name { font-size: 14px; font-weight: 650; letter-spacing: 0.3px; color: var(--foreground); line-height: 1.4; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; flex: 1; }

.nav-label {
  padding: 16px 10px 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--subtle);
}

.nav-label-sub { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--border-soft); }

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #3f3f46;
  transition: background 0.12s, color 0.12s;
}

.nav a:hover { background: var(--muted); color: var(--foreground); }

.nav a.active {
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-weight: 600;
}

.nav a.active svg { color: var(--primary); }
.nav a svg { color: var(--subtle); }
.nav a:hover svg { color: #3f3f46; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-title h1 { font-size: 17.5px; font-weight: 650; letter-spacing: 0.1px; }
.topbar-title p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.today { font-size: 12.5px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.user-menu { position: relative; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  color: var(--foreground);
  transition: background 0.12s, border-color 0.12s;
}

.user-chip:hover { background: var(--muted); border-color: #d4d4d8; }

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: 4px;
  z-index: 30;
}

.dropdown a, .dropdown button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  text-align: left;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--foreground);
  border-radius: 6px;
  cursor: pointer;
}

.dropdown a:hover, .dropdown button:hover { background: var(--muted); }

.dropdown-label { padding: 4px 10px 3px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; color: var(--subtle); }
.dropdown-sep { height: 1px; background: var(--border-soft); margin: 4px 2px; }

.view {
  padding: 26px 32px 44px;
  flex: 1;
  width: 100%;
}

.page-stack { display: flex; flex-direction: column; gap: 20px; }

.loading, .empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 13px;
}

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
}

.card-head h3 { font-size: 16px; font-weight: 650; letter-spacing: 0.1px; }
.card-head p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; }

.link { color: var(--primary-hover); font-size: 13px; font-weight: 550; }
.link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 人员结构 / 党员结构 ---------- */
.structure-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.structure-card { padding: 22px 24px 24px; }

.structure-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.structure-head h3 { font-size: 16px; font-weight: 650; }
.structure-head p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; }

.structure-total { display: flex; align-items: baseline; gap: 4px; }
.structure-total strong { font-size: 32px; font-weight: 800; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; color: var(--primary-dark); }
.structure-total span { font-size: 13px; color: var(--muted-foreground); }

.structure-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-box {
  padding: 16px 10px 15px;
  text-align: center;
  background: #fff;
  border-left: 1px solid var(--border);
}

.stat-box:first-child { border-left: 0; }

.stat-box span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted-foreground); }
.stat-box strong { display: block; margin-top: 6px; font-size: 28px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat-box small { display: block; margin-top: 2px; font-size: 11px; color: var(--subtle); font-variant-numeric: tabular-nums; }

/* =========================================================
   KPI
   ========================================================= */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

.kpi-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  min-height: 128px;
}

.kpi-body { min-width: 0; order: 1; }
.kpi-body strong { font-size: 32px; font-weight: 800; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-body strong em { font-style: normal; font-size: 13px; font-weight: 500; color: var(--muted-foreground); margin-left: 4px; letter-spacing: 0; }
.kpi-body span { display: block; font-size: 13px; font-weight: 600; color: #3f3f46; margin-top: 6px; }
.kpi-body small { display: block; font-size: 12px; color: var(--subtle); margin-top: 3px; }

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  order: 2;
  flex-shrink: 0;
}

.kpi-icon.red, .kpi-icon.neutral { color: var(--primary); border-color: var(--primary-border); background: var(--primary-soft); }

.kpi-primary { background: var(--primary); border-color: var(--primary); box-shadow: 0 6px 18px rgba(220, 38, 38, 0.18); }
.kpi-primary .kpi-body strong { color: #fff; }
.kpi-primary .kpi-body strong em { color: rgba(255, 255, 255, 0.78); }
.kpi-primary .kpi-body span { color: #fff; }
.kpi-primary .kpi-body small { color: rgba(255, 255, 255, 0.74); }
.kpi-primary .kpi-icon { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); color: #fff; }

/* =========================================================
   Dashboard
   ========================================================= */
.dash-row { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; }
.dash-row > .card { min-width: 0; }
.dash-row:not(.dash-row-top) > .card { display: flex; flex-direction: column; }
.dash-row:not(.dash-row-top) .mini-donuts { flex: 1; align-items: center; }
.dash-row-top { align-items: stretch; }
.dash-row-top > .card { display: flex; flex-direction: column; }

.stage-chart-body { flex: 1; display: flex; padding: 0 20px 16px; min-height: 296px; }
.stage-chart-body .echart-stage { height: auto; min-height: 268px; }

.echart { width: 100%; }
.echart-stage { height: 258px; }
.echart-rank { height: 252px; }
.echart-donut { flex-shrink: 0; }

.reminder-list { padding: 0 12px 12px; }

.reminder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.12s;
}

.reminder-item + .reminder-item { border-top: 1px solid var(--border-soft); }
.reminder-item:hover { background: var(--muted); }
.reminder-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.reminder-main strong { font-size: 13.5px; font-weight: 600; }
.reminder-arrow { color: var(--subtle); font-size: 12px; }
.reminder-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.reminder-date { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tag.warn { background: var(--primary-soft); color: var(--primary-hover); border-color: var(--primary-border); }
.tag.danger { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag.ok { background: #fff; color: #52525b; border-color: var(--border); }
.tag.neutral { background: var(--muted); color: var(--muted-foreground); border-color: transparent; }

.activity-list { padding: 4px 24px 18px; }

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.activity-item:last-child { border-bottom: 0; }

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--muted);
  border: 1px solid var(--border-soft);
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.activity-icon.red { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.activity-icon.blue { background: var(--muted); color: #52525b; }
.activity-icon.green { background: var(--muted); color: #3f3f46; }
.activity-icon.amber { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-hover); }

.activity-main { flex: 1; min-width: 0; }
.activity-main p { font-size: 13.5px; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-main p strong { font-weight: 600; }
.activity-main span { display: block; font-size: 12px; color: var(--subtle); margin-top: 2px; }
.activity-item time { font-size: 12.5px; color: #52525b; font-variant-numeric: tabular-nums; white-space: nowrap; }

.mini-donuts { display: flex; justify-content: space-around; gap: 16px; padding: 6px 20px 24px; flex-wrap: wrap; }
.mini-donut { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mini-donut h4 { font-size: 13px; color: var(--muted-foreground); font-weight: 550; }

.donut-box { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }

.legend { display: flex; flex-direction: column; gap: 7px; min-width: 116px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted-foreground); }
.legend-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.legend-row b { margin-left: auto; color: var(--foreground); font-weight: 650; padding-left: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-row b em { font-style: normal; font-weight: 500; font-size: 11px; color: var(--subtle); margin-left: 4px; }
.legend-name { display: flex; align-items: center; gap: 8px; }

/* =========================================================
   Toolbar / Filters
   ========================================================= */
.table-card { overflow: hidden; }

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-label { font-size: 12.5px; font-weight: 600; color: #3f3f46; }

.pill-tabs { display: flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; background: #fff; flex-wrap: wrap; }

.pill-tabs button {
  border: 0;
  background: none;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12.5px;
  color: #52525b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.pill-tabs button em { font-style: normal; font-size: 11px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.pill-tabs button:hover { background: var(--muted); color: var(--foreground); }
.pill-tabs button.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.pill-tabs button.active em { color: var(--primary); }

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--subtle);
  min-width: 236px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.search-box input { border: 0; outline: 0; background: none; flex: 1; font-size: 13px; min-width: 0; }

.toolbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ---------- Buttons（shadcn 风格） ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}

.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-ghost { background: #fff; border-color: var(--border); color: var(--foreground); box-shadow: var(--shadow-xs); }
.btn-ghost:hover:not(:disabled) { background: var(--muted); border-color: #d4d4d8; }

.btn-danger-ghost { background: #fff; border-color: var(--border); color: var(--primary-hover); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--primary-soft); border-color: var(--primary-border); }
.btn-danger-ghost:disabled { color: var(--subtle); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-block { width: 100%; height: 40px; font-size: 14px; font-weight: 600; }

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  background: none;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted-foreground);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.icon-btn:hover { background: var(--muted); color: var(--foreground); }

/* =========================================================
   Tables
   ========================================================= */
.table-wrap { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  background: #fafafa;
  color: #3f3f46;
  font-size: 12.5px;
  font-weight: 650;
  text-align: left;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid #d4d4d8;
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  color: #27272a;
  vertical-align: middle;
}

.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: #f7f7f8; }
.data-table tbody tr.selected { background: var(--primary-soft); }
.data-table tbody tr:last-child td { border-bottom: 0; }

.col-check { width: 42px; }
.col-check input { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; }

.name-link { font-weight: 600; color: var(--foreground); font-size: 13.5px; }
.name-link:hover { color: var(--primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.name-cell span { display: block; font-size: 11.5px; color: var(--subtle); margin-top: 2px; }

.date-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.next-date { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Badge（阶段） ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.full { background: var(--primary); color: #fff; border-color: var(--primary); }
.badge.probationary { background: var(--primary-soft); color: var(--primary-hover); border-color: var(--primary-border); }
.badge.candidate { background: #fff; color: #52525b; border-color: var(--border); }
.badge.activist { background: var(--muted); color: #52525b; border-color: transparent; }
.badge.applicant { background: #fff; color: var(--muted-foreground); border-color: var(--border); border-style: dashed; }

/* 兼容旧 tone */
.badge.red { background: var(--primary-soft); color: var(--primary-hover); border-color: var(--primary-border); }
.badge.green { background: #fff; color: #3f3f46; border-color: var(--border); }
.badge.blue { background: var(--muted); color: #3f3f46; border-color: transparent; }
.badge.amber { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
.badge.gray { background: var(--muted); color: var(--muted-foreground); border-color: transparent; }

.ops { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.text-link { color: var(--primary-hover); font-size: 12.5px; font-weight: 550; }
.text-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

.text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted-foreground);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s;
}

.text-btn:hover { color: var(--foreground); }
.text-btn.danger:hover { color: var(--primary-hover); }

/* ---------- 分页页脚 ---------- */
.table-foot {
  padding: 10px 16px 10px 20px;
  font-size: 12.5px;
  color: #52525b;
  border-top: 1px solid var(--border);
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.table-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-meta strong { color: var(--foreground); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-meta .selection-tip { color: var(--primary-hover); }

.table-pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.page-size { display: inline-flex; align-items: center; gap: 6px; }

.page-size select {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--foreground);
  font-size: 12.5px;
  padding: 0 24px 0 8px;
  cursor: pointer;
  outline: 0;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}

.page-size select:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.pager-btns { display: inline-flex; align-items: center; gap: 4px; }

.pager-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: #3f3f46;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.pager-btn:hover:not(:disabled):not(.active) { background: var(--muted); border-color: #d4d4d8; }
.pager-btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.pager-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.pager-ellipsis { min-width: 26px; height: 30px; display: inline-grid; place-items: center; color: var(--subtle); font-size: 12.5px; }
.pager-info { font-size: 12.5px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* =========================================================
   Member detail
   ========================================================= */
.page-back { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted-foreground); width: fit-content; transition: color 0.12s; }
.page-back:hover { color: var(--foreground); }

.member-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; flex-wrap: wrap; }

.hero-left { display: flex; align-items: center; gap: 14px; }

.avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary-hover);
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 650;
  flex-shrink: 0;
}

.hero-left h2 { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; letter-spacing: 0.1px; }
.hero-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: 12.5px; color: var(--muted-foreground); }
.hero-meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--subtle); display: inline-block; }
.hero-actions { display: flex; align-items: center; gap: 8px; }

.detail-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

.mini-stat { padding: 14px 16px; }
.mini-stat span { display: block; font-size: 12px; font-weight: 500; color: #52525b; }
.mini-stat strong { display: block; font-size: 22px; font-weight: 800; margin-top: 4px; letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.mini-stat strong em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--muted-foreground); margin-left: 3px; }
.mini-stat .progress-track { margin-top: 8px; height: 4px; }

.detail-grid { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }

.timeline-card { padding-bottom: 6px; }

.timeline { list-style: none; margin: 0; padding: 6px 20px 10px; }

.tl-item { position: relative; padding: 0 0 22px 28px; }
.tl-item::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item:last-child::before { display: none; }

.tl-dot {
  position: absolute;
  left: 1px;
  top: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #d4d4d8;
}

.tl-item.done .tl-dot { background: var(--primary); border-color: var(--primary); }
.tl-item.next .tl-dot { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tl-item.done::before { background: var(--primary-border); }

.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head strong { font-size: 13px; font-weight: 600; }
.tl-date { font-size: 12.5px; color: var(--foreground); margin-top: 4px; font-variant-numeric: tabular-nums; }
.tl-date.placeholder { color: var(--subtle); }
.tl-extra { font-size: 11.5px; color: var(--subtle); margin-top: 2px; }

.tl-item.pending .tl-head strong { color: var(--muted-foreground); }

.timeline-note {
  margin: 2px 20px 16px 28px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  color: var(--subtle);
  line-height: 1.75;
}

.state-pill { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; font-weight: 550; border: 1px solid transparent; }
.state-pill.done { color: var(--primary-hover); background: var(--primary-soft); border-color: var(--primary-border); }
.state-pill.next { color: #fff; background: var(--primary); border-color: var(--primary); }
.state-pill.pending { color: var(--muted-foreground); background: var(--muted); }

.progress-track { height: 5px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress-track > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* ---------- 培养记录 ---------- */
.seg-tabs { display: flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; background: #fff; flex-wrap: wrap; }

.seg-tabs button {
  border: 0;
  background: none;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.seg-tabs button:hover { background: var(--muted); color: var(--foreground); }
.seg-tabs button.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }

.record-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 20px 12px;
  font-size: 12.5px;
  color: var(--muted-foreground);
}

.record-summary strong { color: var(--foreground); font-weight: 650; font-variant-numeric: tabular-nums; }

.record-empty { padding: 40px 20px; text-align: center; font-size: 12.5px; color: var(--subtle); }
.record-table td, .record-table th { white-space: nowrap; }
.record-table td.wrap-text { white-space: normal; min-width: 200px; line-height: 1.6; }

/* =========================================================
   Stats
   ========================================================= */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.stats-grid .span-2 { grid-column: span 2; }
.stats-grid > .card { display: flex; flex-direction: column; }

.chart-body { padding: 6px 20px 20px; flex: 1; display: flex; align-items: center; }
.chart-body > * { width: 100%; }

.summary-list { display: flex; flex-direction: column; gap: 4px; width: 100%; }

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}

.summary-row:last-child { border-bottom: 0; }
.summary-label { display: inline-flex; align-items: center; gap: 8px; color: #3f3f46; font-weight: 500; }
.summary-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--primary); display: inline-block; }
.summary-dot.green { background: #b91c1c; }
.summary-dot.blue { background: #f87171; }
.summary-dot.amber { background: #d4d4d8; }
.summary-value { color: var(--foreground); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-value em { font-style: normal; color: var(--muted-foreground); font-weight: 400; }

/* =========================================================
   Settings & Password
   ========================================================= */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; max-width: 1000px; }
.settings-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.password-layout { display: grid; grid-template-columns: 420px 1fr; gap: 16px; align-items: start; max-width: 980px; }

.password-card { padding: 22px; }
.password-card h3 { font-size: 15px; font-weight: 650; }
.password-card > p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 4px; }

.password-form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }

.password-tips { padding: 22px; background: #fff; }
.password-tips h3 { font-size: 14px; font-weight: 650; }
.password-tips ul { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.password-tips li { position: relative; padding-left: 14px; font-size: 12.5px; color: var(--muted-foreground); line-height: 1.7; }
.password-tips li::before { content: ""; position: absolute; left: 0; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }

/* =========================================================
   Account management
   ========================================================= */
.users-toolbar-info h3 { font-size: 15px; font-weight: 650; }
.users-toolbar-info p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; max-width: 560px; line-height: 1.6; }

.user-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.avatar-sm { width: 32px; height: 32px; border-radius: 8px; background: var(--primary-soft); border: 1px solid var(--primary-border); color: var(--primary-hover); display: grid; place-items: center; font-size: 13px; font-weight: 650; flex-shrink: 0; }
.user-cell strong { display: block; font-size: 13.5px; font-weight: 600; }
.user-login { display: block; font-size: 11.5px; color: var(--subtle); margin-top: 1px; }

.role-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.role-badge.teacher { background: var(--primary); color: #fff; }
.role-badge.assistant { background: var(--muted); color: #52525b; border-color: var(--border); }

.perm-tags { display: flex; flex-wrap: wrap; gap: 5px; max-width: 380px; }
.perm-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; background: var(--muted); color: #52525b; font-size: 11px; font-weight: 500; white-space: nowrap; }
.perm-tag.all { background: var(--primary-soft); color: var(--primary-hover); box-shadow: inset 0 0 0 1px var(--primary-border); }
.account-self { font-size: 12.5px; color: var(--subtle); }
.account-note { padding: 12px 24px 14px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--subtle); line-height: 1.7; }
.account-table th, .account-table td { white-space: nowrap; }

.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.permission-item { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.permission-item:hover { border-color: #d4d4d8; background: #fafafa; }
.permission-item:has(input:checked) { border-color: var(--primary-border); background: var(--primary-soft); }
.permission-item input[type="checkbox"] { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.permission-item strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--foreground); }
.permission-item span span { display: block; font-size: 11.5px; color: var(--muted-foreground); line-height: 1.55; margin-top: 2px; }
.permission-hint { font-size: 11.5px; color: var(--subtle); line-height: 1.6; }
.permission-hint.warn { color: var(--primary-hover); }

/* =========================================================
   Audit logs
   ========================================================= */
.log-filter {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: #3f3f46;
  font-size: 13px;
  padding: 0 30px 0 12px;
  cursor: pointer;
  outline: 0;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.log-filter:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.log-table th, .log-table td { white-space: nowrap; }

.log-action {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.log-action.success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.log-action.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.log-action.danger { background: var(--primary-soft); color: var(--primary-hover); border-color: var(--primary-border); }
.log-action.neutral { background: var(--muted); color: #52525b; border-color: var(--border); }

.log-detail { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: #52525b; }

.log-ip { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* =========================================================
   File collection
   ========================================================= */
.tag.green { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.role-badge.student { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

.field-tip { font-size: 11.5px; color: var(--subtle); line-height: 1.6; }

.collection-table th, .collection-table td { white-space: nowrap; }

.collect-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px; flex-wrap: wrap; }
.collect-hero-info { flex: 1; min-width: 260px; }
.collect-hero-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.collect-hero-title h2 { font-size: 18px; font-weight: 650; }
.collect-hero-meta { margin-top: 6px; font-size: 12.5px; color: var(--muted-foreground); }
.collect-progress-bar { margin-top: 14px; height: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; max-width: 420px; }
.collect-progress-bar span { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.3s ease; }
.collect-progress-text { margin-top: 8px; font-size: 12.5px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.collect-progress-text strong { color: var(--foreground); }
.collect-hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.collect-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }

.collect-grid-card, .collect-files-card { overflow: hidden; }
.collect-filters { display: flex; align-items: center; gap: 8px; padding: 2px 20px 0; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
  font-size: 12px; font-weight: 500; color: var(--muted-foreground);
  font-family: inherit; cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.filter-chip:hover { border-color: #d4d4d8; color: var(--foreground); }
.filter-chip em { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--foreground); }
.filter-chip.active { background: #18181b; border-color: #18181b; color: #d4d4d8; }
.filter-chip.active em { color: #fff; }
.filter-chip.active .dot.pending { background: #52525b; border-color: #71717a; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.all { background: #a1a1aa; }
.dot.submitted { background: #15803d; }
.dot.rejected { background: #dc2626; }
.dot.pending { background: #fff; border: 1px solid #d4d4d8; }
.dot.exempt { background: #e4e4e7; }

.student-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 20px 20px; max-height: 560px; overflow-y: auto; }
.student-grid-empty { grid-column: 1 / -1; padding: 30px 0; text-align: center; font-size: 12.5px; color: var(--subtle); }
.student-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; text-align: left; min-width: 0; transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.student-chip:hover { border-color: #d4d4d8; box-shadow: 0 1px 3px rgba(9, 9, 11, 0.08); }
.student-chip:active { transform: scale(0.98); }
.student-chip-name { font-size: 12.5px; font-weight: 600; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.student-chip-meta { font-size: 10.5px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.student-chip-state { font-size: 10.5px; font-weight: 600; margin-top: 2px; }
.student-chip.submitted { background: #f0fdf4; border-color: #bbf7d0; }
.student-chip.submitted .student-chip-state { color: #15803d; }
.student-chip.rejected { background: #fef2f2; border-color: #fecaca; }
.student-chip.rejected .student-chip-state { color: #b91c1c; }
.student-chip.rejected .student-chip-name { color: #991b1b; }
.student-chip.pending .student-chip-state { color: #a1a1aa; }
.student-chip.exempt { background: #f4f4f5; border-color: #e4e4e7; }
.student-chip.exempt .student-chip-name { color: #a1a1aa; }
.student-chip.exempt .student-chip-state { color: #a1a1aa; }

.collect-files-card .card-head { padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.collect-file-list { display: flex; flex-direction: column; }
.collect-file { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); }
.collect-file:last-child { border-bottom: 0; }
.collect-file.is-rejected { background: #fef2f2; }
.collect-file.is-rejected .file-info strong { color: #b91c1c; }
.file-seq { font-size: 11px; font-weight: 700; color: var(--subtle); font-variant-numeric: tabular-nums; width: 20px; flex-shrink: 0; }
.file-thumb {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--border-soft); background: var(--muted);
  display: grid; place-items: center;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-thumb.is-doc em { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: 0.3px; color: var(--muted-foreground); text-transform: uppercase; }
.file-info { flex: 1; min-width: 0; }
.file-info strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info span { display: block; font-size: 11.5px; color: var(--subtle); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-time { font-size: 11.5px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.preview-body { display: flex; flex-direction: column; gap: 14px; }
.preview-image-wrap {
  border: 1px solid var(--border-soft); border-radius: 10px; background: #fafafa;
  padding: 12px; display: grid; place-items: center; min-height: 180px;
}
.preview-image-wrap img { max-width: 100%; max-height: 56vh; border-radius: 6px; display: block; }
.preview-fallback {
  border: 1px dashed var(--border); border-radius: 10px; background: #fafafa;
  padding: 34px 16px; text-align: center;
}
.preview-fallback em { font-style: normal; font-size: 22px; font-weight: 700; letter-spacing: 1px; color: var(--muted-foreground); }
.preview-fallback p { margin-top: 8px; font-size: 12.5px; color: var(--subtle); }
.preview-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.preview-meta div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.preview-meta span { font-size: 11.5px; color: var(--subtle); }
.preview-meta strong { font-size: 12.5px; font-weight: 600; word-break: break-all; }

.share-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.share-qr-wrap { padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.share-qr { display: block; width: 200px; height: 200px; }
.share-tip { font-size: 12.5px; color: var(--muted-foreground); text-align: center; }
.share-link-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.share-link-row input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 12px; color: #3f3f46; background: var(--muted); }
.share-note { font-size: 11.5px; color: var(--subtle); }

.collect-form-hint { font-size: 12px; color: var(--subtle); line-height: 1.7; }

/* =========================================================
   Forms
   ========================================================= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-full { grid-column: 1 / -1; }

.field > span {
  font-size: 12.5px;
  font-weight: 550;
  color: #3f3f46;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field > span em { font-style: normal; color: var(--primary); }
.field > span small { font-weight: 400; color: var(--subtle); }

.field input, .field select, .field textarea {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  outline: 0;
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}

.field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: var(--subtle); }

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.field input:disabled, .field select:disabled { background: var(--muted); color: var(--muted-foreground); }

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 26px;
  cursor: pointer;
}

.field-check { flex-direction: row; align-items: center; gap: 8px; padding-top: 20px; }
.field-check input { width: 15px; height: 15px; accent-color: var(--primary); }

.form-hint { font-size: 11.5px; color: var(--subtle); line-height: 1.6; }
.form-error { font-size: 12.5px; color: var(--primary-hover); min-height: 18px; }

.field > span, .login-field > span { color: #27272a; }

.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #3f3f46; cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* =========================================================
   Modal / Toast
   ========================================================= */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(24, 24, 27, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 18px 30px;
  overflow-y: auto;
  animation: fade-in 0.15s ease;
}

.modal {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: modal-in 0.16s ease;
}

.modal.modal-sm { max-width: 400px; }
.modal.modal-lg { max-width: 640px; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.modal-head h3 { font-size: 15.5px; font-weight: 650; }
.modal-head p { font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; }

.modal-body { padding: 16px 20px 6px; }
.modal-text { font-size: 13.5px; color: #3f3f46; line-height: 1.7; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
}

.import-tip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--muted); border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 14px; }
.import-tip > span { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.6; }
.import-tip .btn { flex-shrink: 0; }

.upload-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 26px 18px; border: 1.5px dashed var(--border); border-radius: 10px; background: #fafafa; color: var(--muted-foreground); text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.upload-box:hover, .upload-box.dragover { border-color: var(--primary); background: var(--primary-soft); }
.upload-box.dragover { border-style: solid; }
.upload-box svg { color: var(--primary); }
.upload-box strong { font-size: 13.5px; font-weight: 600; color: var(--foreground); word-break: break-all; }
.upload-box > span { font-size: 12px; }
.upload-box.has-file { border-style: solid; border-color: var(--primary-border); background: var(--primary-soft); }

.import-result { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.import-errors { margin: 10px 0 0; padding: 0; list-style: none; max-height: 168px; overflow-y: auto; font-size: 12.5px; color: #52525b; line-height: 1.9; }
.import-errors li { position: relative; padding-left: 12px; }
.import-errors li::before { content: ""; position: absolute; left: 0; top: 10px; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }
.import-more { margin-top: 8px; font-size: 12px; color: var(--subtle); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }

.toast-root {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  color: var(--foreground);
  animation: toast-in 0.18s ease;
}

.toast.success { border-left-color: var(--primary); }
.toast.error { border-left-color: #18181b; }

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

/* =========================================================
   Login
   ========================================================= */
.login-body {
  min-height: 100vh;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}

.login-wrap { width: 100%; max-width: 404px; display: flex; flex-direction: column; align-items: stretch; }

.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; }

.login-brand h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.3px; }

.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(9, 9, 11, 0.06);
  padding: 28px 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-card h2 { font-size: 16px; font-weight: 650; }
.login-hint { font-size: 12.5px; color: var(--muted-foreground); margin-top: -8px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span { font-size: 12.5px; font-weight: 550; color: #3f3f46; }

.login-field input {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 11px;
  font-size: 13.5px;
  outline: 0;
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.login-field input::placeholder { color: var(--subtle); }
.login-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.login-error { font-size: 12.5px; color: var(--primary-hover); min-height: 18px; }

.login-card .btn-block { margin-top: 2px; }

.login-copyright { font-size: 11.5px; color: var(--subtle); text-align: center; margin-top: 22px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1280px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .detail-stats { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid .span-2 { grid-column: span 2; }
}

@media (max-width: 1080px) {
  .dash-row { grid-template-columns: 1fr; }
  .structure-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .password-layout, .settings-layout { grid-template-columns: 1fr; }
  .collect-layout { grid-template-columns: 1fr; }
  .student-grid { grid-template-columns: repeat(4, 1fr); max-height: none; }
}

@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .view { padding: 18px; }
  .topbar { padding: 0 18px; }
  .today { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid .span-2 { grid-column: auto; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  .table-foot { justify-content: center; }
}

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { height: 64px; padding: 0 16px; }
  .brand-name { font-size: 13.5px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 4px 10px 10px; gap: 4px; }
  .nav-label { display: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar-title h1 { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .view { padding: 14px; }
  .kpi-row { grid-template-columns: 1fr; }
  .structure-grid { grid-template-columns: repeat(3, 1fr); }
  .table-toolbar { padding: 12px 14px; }
  .search-box { min-width: 100%; }
  .log-filter { width: 100%; }
  .log-detail { max-width: 180px; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .member-hero { padding: 16px; }
  .avatar-lg { width: 46px; height: 46px; font-size: 19px; }
  .hero-left h2 { font-size: 17px; }
  .detail-stats { grid-template-columns: 1fr; }
  .table-foot { padding: 10px 14px; }
  .table-pager { gap: 8px; }
  .modal-mask { padding: 4vh 12px 20px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .import-tip { flex-direction: column; align-items: flex-start; }
  .student-grid { grid-template-columns: repeat(3, 1fr); padding: 12px 14px 16px; }
  .collect-hero { padding: 16px; }
  .collect-hero-actions { width: 100%; }
  .collect-hero-actions .btn { flex: 1; }
  .file-time { display: none; }
  .collect-filters { padding: 2px 14px 0; }
  .collect-file { padding: 12px 14px; gap: 9px; }
  .file-seq { display: none; }
  .file-actions { flex-direction: column; gap: 4px; }
  .preview-meta { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .permission-grid { grid-template-columns: 1fr; }
  .perm-tags { max-width: none; }
}
