/* ============================================
   学科会员管理系统 v2.0 - 精致化样式
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; }

:root {
  --primary: #4f46e5;
  --primary-2: #2563eb;
  --primary-3: #7c3aed;
  --primary-soft: #eef2ff;
  --primary-soft-2: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;
  --sidebar-bg: linear-gradient(180deg, #111a2e 0%, #0f172a 100%);
  --bg: #f4f5fa;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --border: #e6e8f0;
  --border-soft: #f1f2f7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(16,24,40,.04);
  --shadow-sm: 0 1px 3px rgba(16,24,40,.06), 0 2px 8px rgba(16,24,40,.04);
  --shadow: 0 2px 6px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
  --shadow-lg: 0 6px 16px rgba(16,24,40,.08), 0 20px 48px rgba(16,24,40,.12);
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 45%, #2563eb 100%);
  --grad-success: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --grad-warning: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-danger: linear-gradient(135deg, #fb7185 0%, #dc2626 100%);
  --grad-info: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5e0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b6bcc9; }

/* ===== 登录页 ===== */
.login-page {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
  z-index: 2000;
}
.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 70%, #1d4ed8 100%);
}
.login-bg::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(99,102,241,.35), transparent),
    radial-gradient(ellipse 50% 40% at 80% 30%, rgba(37,99,235,.3), transparent),
    radial-gradient(ellipse 40% 40% at 60% 90%, rgba(124,58,237,.25), transparent);
}
.login-bg::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
}
.login-card {
  position: relative;
  width: 400px; max-width: 92vw;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 40px 38px 32px;
  box-shadow: 0 24px 80px rgba(2,6,23,.45);
  animation: loginIn .5s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}
.login-logo-img {
  max-height: 56px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
}
.login-title { text-align: center; font-size: 21px; font-weight: 700; margin-top: 14px; letter-spacing: .5px; }
.login-sub { text-align: center; color: var(--text-3); font-size: 12.5px; letter-spacing: 1.5px; margin: 4px 0 26px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .form-group label { margin-bottom: 6px; }
.login-form .form-control {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #fafbfe;
  transition: all .2s;
}
.login-form .form-control:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; letter-spacing: 3px; border-radius: 10px; }
.login-hint { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.login-footer {
  position: absolute; bottom: 22px;
  color: rgba(255,255,255,.45);
  font-size: 12px;
  letter-spacing: 1px;
}

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

.sidebar {
  width: 232px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  box-shadow: 2px 0 20px rgba(2,6,23,.08);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo-img {
  max-height: 38px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  padding: 8px 14px;
  background: rgba(255,255,255,.92);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(2,6,23,.08);
}

.nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-group-label {
  font-size: 10.5px;
  color: #94a3b8;
  letter-spacing: 1.5px;
  padding: 14px 10px 5px;
  text-transform: uppercase;
}
.nav-group-label:first-child { padding-top: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13.5px;
  transition: all .18s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #ffffff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79,70,229,.35), rgba(79,70,229,.12));
  color: #fff;
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3.5px; border-radius: 0 4px 4px 0;
  background: var(--grad-primary);
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.05);
  border-radius: 12px;
  padding: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 15px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-info strong { color: #e2e8f0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { color: #94a3b8; font-size: 11px; }
.logout-btn {
  width: 30px; height: 30px;
  border: none; border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #cbd5e1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.logout-btn:hover { background: var(--danger); color: #fff; }

.main {
  flex: 1;
  margin-left: 232px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  padding: 15px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header h1 { font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.header h1::after {
  content: '';
  display: inline-block;
  width: 4px; height: 18px;
  background: var(--grad-primary);
  border-radius: 4px;
  margin-left: 10px;
  vertical-align: -2px;
}
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  align-items: center;
  justify-content: center;
}
.date-text { color: var(--text-3); font-size: 12.5px; letter-spacing: .3px; }

.content {
  padding: 24px 28px;
  flex: 1;
  animation: viewIn .3s ease;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -30px; top: -30px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,70,229,.06), transparent 70%);
  transition: transform .3s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
  width: 50px; height: 50px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.purple { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.cyan { background: var(--info-soft); color: var(--info); }
.stat-info { flex: 1; min-width: 0; }
.stat-label { color: var(--text-2); font-size: 12.5px; margin-bottom: 1px; }
.stat-value { font-size: 23px; font-weight: 750; letter-spacing: -.3px; line-height: 1.25; }
.stat-value.gradient-text { background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.stat-sub b { color: var(--text-2); font-weight: 600; }

/* 到期提醒横幅 */
.expiry-banner {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(90deg, var(--warning-soft), #fffbe8 60%, var(--warning-soft));
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 13px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.expiry-banner .eb-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--grad-warning);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(217,119,6,.3);
}
.expiry-banner .eb-text { flex: 1; font-size: 13px; color: #78350f; }
.expiry-banner .eb-text strong { font-size: 13.5px; }
.expiry-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.expiry-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.85);
  border: 1px solid #fde68a;
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 12px;
  color: #92400e;
}
.expiry-chip b { color: #b45309; }
.expiry-chip.danger { border-color: #fecaca; color: #991b1b; }
.expiry-chip.danger b { color: var(--danger); }
.eb-actions { flex-shrink: 0; }

/* ===== 图表区 ===== */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.dash-card h3 {
  font-size: 14.5px; font-weight: 650;
  margin-bottom: 16px;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.dash-card h3 .h3-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 20px;
}

.dash-card h3 .ic { color: var(--primary); }

/* 柱状图 */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-value { font-size: 11.5px; font-weight: 650; color: var(--primary); }
.bar {
  width: 65%;
  max-width: 42px;
  min-height: 4px;
  background: var(--grad-primary);
  border-radius: 8px 8px 3px 3px;
  transition: height .5s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 4px 10px rgba(79,70,229,.25);
}
.bar-label { font-size: 11.5px; color: var(--text-3); }

/* 饼图 */
.pie-wrap { display: flex; align-items: center; gap: 22px; }
.pie-chart { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.pie-chart svg { width: 100%; height: 100%; }
.pie-center {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.pie-center strong { font-size: 19px; }
.pie-center span { font-size: 10.5px; color: var(--text-3); }
.legend { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend-item .legend-name { color: var(--text-2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-item .legend-val { font-weight: 650; }
.legend-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
}
.legend-bar .lb-label { width: 44px; color: var(--text-2); flex-shrink: 0; }
.legend-bar .lb-track { flex: 1; height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.legend-bar .lb-fill { height: 100%; border-radius: 6px; transition: width .5s ease; }
.legend-bar .lb-val { width: 54px; text-align: right; font-weight: 650; font-size: 12px; }

/* 快捷操作 */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #fafbfe;
  cursor: pointer;
  transition: all .18s;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}
.quick-action:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,.12);
}
.quick-action .qa-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
  color: var(--primary);
}

/* ===== 页面头部/工具栏 ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.page-header .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.page-header .sub b { color: var(--primary); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 11px 14px;
  box-shadow: var(--shadow-xs);
}
.toolbar-spacer { flex: 1; }

/* 搜索框 */
.search-box { position: relative; }
.search-box input {
  padding: 8.5px 12px 8.5px 34px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 13px;
  width: 230px;
  background: #fafbfe;
  color: var(--text);
  transition: all .18s;
  font-family: inherit;
}
.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79,70,229,.1);
}
.search-box::before {
  content: "";
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* ===== 表格 ===== */
.table-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f8f9fd;
  color: var(--text-3);
  font-weight: 600;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  font-size: 11.5px;
  letter-spacing: .6px;
  text-transform: uppercase;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f7f8fd; }

.table-empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.table-empty .empty-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 10px; opacity: .4; color: var(--text-3); }
.table-empty .empty-sub { font-size: 12.5px; margin-top: 4px; }

/* 徽章 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 550;
  white-space: nowrap;
  letter-spacing: .2px;
}
.tag-blue    { background: var(--primary-soft); color: var(--primary); }
.tag-green   { background: var(--success-soft); color: var(--success); }
.tag-yellow  { background: var(--warning-soft); color: var(--warning); }
.tag-red     { background: var(--danger-soft); color: var(--danger); }
.tag-gray    { background: #f1f5f9; color: #64748b; }
.tag-cyan    { background: var(--info-soft); color: var(--info); }
.tag-purple  { background: #f5f3ff; color: #7c3aed; }
.tag .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* 头像 */
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  margin-right: 8px;
  vertical-align: -8px;
}
.avatar.male { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.avatar.female { background: linear-gradient(135deg, #f472b6, #db2777); }
.cell-name { display: flex; align-items: center; }
.cell-name .c-name { font-weight: 600; }

/* 编号 */
.mono-no {
  font-family: "SF Mono", Consolas, "Cascadia Code", monospace;
  font-size: 11.5px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .16s;
  line-height: 1.5;
  background: none;
  color: var(--text);
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: .2px;
}
.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,70,229,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-danger { background: var(--grad-danger); color: #fff; box-shadow: 0 4px 12px rgba(220,38,38,.25); }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(220,38,38,.35); }
.btn-success { background: var(--grad-success); color: #fff; box-shadow: 0 4px 12px rgba(5,150,105,.25); }
.btn-success:hover { transform: translateY(-1px); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #e0e7ff; }
.btn-sm { padding: 4.5px 11px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.btn-icon {
  width: 29px; height: 29px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-3);
  transition: all .14s;
  vertical-align: middle;
}
.btn-icon:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--border-soft); }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon.success:hover { background: var(--success-soft); color: var(--success); }

/* 操作按钮组 */
.actions { display: inline-flex; gap: 2px; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.form-group label .req { color: var(--danger); }
.form-control {
  padding: 8.5px 12px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: all .18s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,.1);
}
textarea.form-control { resize: vertical; min-height: 68px; }
select.form-control { cursor: pointer; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .24s cubic-bezier(.2,.9,.3,1.15);
}
.modal-lg { max-width: 780px; }
.modal-sm { max-width: 400px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-header h3 {
  font-size: 15.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header h3::before {
  content: '';
  width: 4px; height: 16px;
  border-radius: 4px;
  background: var(--grad-primary);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px 9px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: all .14s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  margin-top: 18px;
}

/* 详情 */
.detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.detail-item { background: #f8f9fd; border: 1px solid var(--border-soft); border-radius: 10px; padding: 9px 13px; }
.detail-item .label { font-size: 11px; color: var(--text-3); margin-bottom: 2px; letter-spacing: .3px; }
.detail-item .value { font-size: 13.5px; font-weight: 550; }
.detail-item.full { grid-column: 1 / -1; }
.detail-section { margin-bottom: 18px; }
.detail-section h4 {
  font-size: 13.5px; font-weight: 650;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 8px;
}
.detail-section h4 .ic { color: var(--primary); }
.detail-total {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  margin-top: 6px;
  font-size: 13.5px;
}
.detail-total .total-label { color: var(--text-3); }
.detail-total .total-value { font-weight: 750; color: var(--primary); font-size: 16px; }

/* ===== 文件上传 ===== */
.file-upload-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.file-upload-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.file-upload-btn input[type="file"] { display: none; }
.file-hint { font-size: 11.5px; color: var(--text-3); }
.file-list {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #f8fafc;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}
.file-empty {
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 16px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 5px;
  border: 1px solid var(--border-soft);
  transition: all .15s;
}
.file-item:last-child { margin-bottom: 0; }
.file-item:hover { border-color: var(--primary-soft); box-shadow: 0 2px 8px rgba(79,70,229,.08); }
.file-icon { display: inline-flex; align-items: center; flex-shrink: 0; color: var(--text-3); }
.file-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size { font-size: 11.5px; color: var(--text-3); flex-shrink: 0; }
.file-date { font-size: 11.5px; color: var(--text-3); flex-shrink: 0; }
.file-action {
  border: none;
  background: var(--primary-soft);
  color: var(--primary);
  width: 26px; height: 26px;
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.file-action:hover { background: var(--primary); color: #fff; }
.file-action.danger { background: #fef2f2; color: #dc2626; }
.file-action.danger:hover { background: #dc2626; color: #fff; }
.pay-voucher {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 11px;
  padding: 11px 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  font-size: 13px;
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
  max-width: 360px;
}
.toast-ic { display: flex; align-items: center; flex-shrink: 0; }
.toast.success { border-left: 4px solid var(--success); }
.toast.success .toast-ic { color: var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.error .toast-ic { color: var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.info .toast-ic { color: var(--primary); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.warning .toast-ic { color: var(--warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-out { opacity: 0; transform: translateX(40px); transition: all .3s; }

/* 加载状态 */
.loading-wrap { padding: 60px; text-align: center; color: var(--text-3); }
.loading-spinner {
  width: 34px; height: 34px;
  margin: 0 auto 12px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 打印单据 ===== */
.print-area {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  font-size: 13px;
  color: #1e293b;
}
.print-area .pr-head {
  text-align: center;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.print-area .pr-head h2 { font-size: 19px; letter-spacing: 4px; }
.print-area .pr-head p { color: #64748b; font-size: 12px; margin-top: 3px; }
.pr-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-bottom: 14px; }
.pr-meta .pm-item { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #e2e8f0; }
.pr-meta .pm-item .k { color: #64748b; }
.pr-meta .pm-item .v { font-weight: 600; }
.pr-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.pr-table th, .pr-table td { border: 1px solid #e2e8f0; padding: 8px 10px; text-align: left; font-size: 12.5px; }
.pr-table th { background: #f8fafc; }
.pr-total { text-align: right; font-size: 15px; margin-top: 8px; }
.pr-total b { color: #1e293b; font-size: 17px; }
.pr-foot { text-align: center; color: #94a3b8; font-size: 11.5px; margin-top: 22px; padding-top: 10px; border-top: 1px dashed #e2e8f0; }

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area {
    position: absolute;
    left: 0; top: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .no-print { display: none !important; }
}

/* ===== 响应式 ===== */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-info { grid-template-columns: 1fr; }
  .search-box input { width: 180px; }
  .content { padding: 16px; }
  .header { padding: 12px 16px; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box input { width: 100%; }
  .expiry-banner { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 30px 24px 24px; }
}
