/* ================================================
   会计CRM系统 - 主样式表 (v2026.03.31.2 修复嵌套弹窗z-index)
   ================================================ */

/* CSS变量 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0891b2;
  --info-light: #ecfeff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-width: 220px;
  --sidebar-bg: #0f172a;
  --topbar-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* 重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Microsoft YaHei', 'PingFang SC', Arial, sans-serif; color: var(--gray-800); background: var(--gray-100); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }

/* ================================================
   布局
   ================================================ */
.crm-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-text { color: #fff; font-size: 15px; font-weight: 700; }

.sidebar-nav { padding: 8px 0 20px; }
.nav-group-title {
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 16px 6px;
}
.nav-group-title.clickable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.nav-group-title.clickable:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}
.nav-group-title.clickable .nav-arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}
.nav-group-title.collapsed .nav-arrow {
  transform: rotate(-90deg);
}
.nav-group-content {
  overflow: hidden;
  max-height: 1000px;
  transition: max-height 0.25s ease;
}
.nav-group-content.collapsed {
  max-height: 0;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: rgba(255,255,255,0.65);
  font-size: 13.5px;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ================================================
   侧边栏折叠状态
   ================================================ */
.sidebar.collapsed {
  width: 60px;
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-item span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar.collapsed .logo-icon {
  margin: 0 auto;
}
.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 20px 0;
}
.sidebar.collapsed .nav-item {
  padding: 9px 22px;
  justify-content: center;
}
.sidebar.collapsed .nav-item:hover span,
.sidebar.collapsed .sidebar:hover .nav-item span,
.sidebar.collapsed .sidebar:hover .logo-text,
.sidebar.collapsed .sidebar:hover .nav-group-title {
  opacity: 1;
  width: auto;
  white-space: normal;
}
.sidebar.collapsed .sidebar:hover .nav-item {
  justify-content: flex-start;
  padding: 9px 16px;
}
.sidebar.collapsed .sidebar:hover .logo-text,
.sidebar.collapsed .sidebar:hover .nav-group-title {
  width: auto;
  padding-left: 0;
}
.main-wrapper {
  transition: margin-left 0.25s ease;
}

/* 主内容 */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}
.sidebar.collapsed + .main-wrapper {
  margin-left: 60px;
}

/* 顶部栏 */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: 6px; color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { background: var(--gray-100); color: var(--gray-700); }
.page-title { font-size: 16px; font-weight: 600; color: var(--gray-800); }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--gray-500);
  transition: all 0.15s; text-decoration: none;
}
.topbar-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.topbar-icon .badge {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--danger); color: #fff;
  border-radius: 50%; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

.user-menu {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
  position: relative; transition: background 0.15s;
}
.user-menu:hover { background: var(--gray-100); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.user-name { font-size: 14px; color: var(--gray-700); }
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 160px; overflow: hidden; z-index: 200;
}
.user-dropdown.show { display: block; }
.dropdown-info { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
.dropdown-info strong { display: block; font-size: 14px; color: var(--gray-800); }
.dropdown-info span { font-size: 12px; color: var(--gray-500); }
.user-dropdown a { display: block; padding: 10px 16px; font-size: 14px; color: var(--gray-700); transition: background 0.1s; }
.user-dropdown a:hover { background: var(--gray-50); text-decoration: none; }

/* 主内容区 */
.main-content { flex: 1; padding: 24px; overflow-x: hidden; }

/* ================================================
   卡片
   ================================================ */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 20px; }

/* ================================================
   统计卡片
   ================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }
.stat-info { min-width: 0; flex: 1; overflow: hidden; }
.stat-num {
  font-size: 26px; font-weight: 700; color: var(--gray-800); line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ================================================
   表格
   ================================================ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; font-size: 13.5px; }
.data-table thead th {
  padding: 12px 16px; text-align: left;
  background: var(--gray-50); color: var(--gray-600);
  font-weight: 600; font-size: 12.5px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody td { padding: 12px 16px; color: var(--gray-700); vertical-align: middle; }
.data-table tbody tr:last-child { border-bottom: none; }

/* ================================================
   表单
   ================================================ */
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-1 { grid-template-columns: 1fr; }
.form-group { margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-800);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-group .hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ================================================
   按钮
   ================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  border: 1.5px solid transparent; cursor: pointer;
  transition: all 0.15s; text-decoration: none;
  white-space: nowrap; line-height: 1.5;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; border-color: #15803d; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #b45309; }

.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ================================================
   标签/徽章
   ================================================ */
.badge-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
}
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-green { background: #dcfce7; color: #16a34a; }
.tag-yellow { background: #fef3c7; color: #92400e; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-gray { background: #f1f5f9; color: #475569; }
.tag-cyan { background: #cffafe; color: #0e7490; }
.tag-purple { background: #ede9fe; color: #6d28d9; }
.tag-orange { background: #ffedd5; color: #c2410c; }

/* ================================================
   分页
   ================================================ */
.pagination {
  display: flex; align-items: center; gap: 4px;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
}
.pagination .page-info { color: var(--gray-500); font-size: 13px; flex: 1; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  font-size: 13px; cursor: pointer; background: #fff;
  color: var(--gray-700); transition: all 0.15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ================================================
   搜索/筛选栏
   ================================================ */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.search-input-wrap {
  position: relative; flex: 1; min-width: 200px; max-width: 320px;
}
.search-input-wrap .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); width: 16px; height: 16px; pointer-events: none;
}
.search-input { padding-left: 34px !important; }

/* ================================================
   弹窗
   ================================================ */
.modal-overlay {
  display: none; position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 1000;
  align-items: center; justify-content: center;
}
/* 嵌套弹窗支持：同一页面多个弹窗时，后开的弹窗层级更高 */
.modal-overlay.overlay-top { z-index: 1100 !important; }
.modal-overlay.overlay-top + .modal-overlay { z-index: 1200 !important; }
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px;
  width: 90%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 800px; }
.modal-sm { max-width: 400px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 4px; border-radius: 4px; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

/* ================================================
   提示 Toast
   ================================================ */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); pointer-events: all;
  animation: toastIn 0.25s ease;
  display: flex; align-items: center; gap: 8px;
  min-width: 200px; max-width: 360px;
}
@keyframes toastIn { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }
.toast.success { background: #fff; border-left: 4px solid var(--success); color: var(--gray-800); }
.toast.error { background: #fff; border-left: 4px solid var(--danger); color: var(--gray-800); }
.toast.warning { background: #fff; border-left: 4px solid var(--warning); color: var(--gray-800); }
.toast.info { background: #fff; border-left: 4px solid var(--primary); color: var(--gray-800); }

/* ================================================
   空状态
   ================================================ */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--gray-400);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

/* ================================================
   详情面板
   ================================================ */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.detail-item { }
.detail-item .label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.detail-item .value { font-size: 14px; color: var(--gray-800); font-weight: 500; }

/* ================================================
   步骤条
   ================================================ */
.steps { display: flex; align-items: center; margin: 16px 0; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.step::before { content: ''; position: absolute; top: 16px; left: -50%; right: 50%; height: 2px; background: var(--gray-200); z-index: 0; }
.step:first-child::before { display: none; }
.step-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--gray-200); color: var(--gray-500); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; position: relative; z-index: 1; }
.step.done .step-dot { background: var(--success); color: #fff; }
.step.active .step-dot { background: var(--primary); color: #fff; }
.step.done::before { background: var(--success); }
.step-label { font-size: 12px; color: var(--gray-500); margin-top: 6px; text-align: center; }
.step.active .step-label { color: var(--primary); font-weight: 600; }
.step.done .step-label { color: var(--success); }

/* ================================================
   快速操作按钮区
   ================================================ */
.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.action-bar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.action-bar-right { display: flex; align-items: center; gap: 10px; }

/* ================================================
   Dashboard 专用
   ================================================ */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-top: 24px; }
.todo-list { list-style: none; }
.todo-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
  font-size: 13.5px; color: var(--gray-700);
}
.todo-list li:last-child { border-bottom: none; }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.todo-dot.red { background: var(--danger); }
.todo-dot.yellow { background: var(--warning); }
.todo-dot.blue { background: var(--primary); }

/* ================================================
   响应式
   ================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .action-bar { flex-direction: column; align-items: flex-start; }
  .main-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .user-name { display: none; }
}

/* ================================================
   打印样式
   ================================================ */
@media print {
  .sidebar, .topbar, .action-bar, .pagination { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
}

/* ================================================
   其他实用样式
   ================================================ */
.text-muted { color: var(--gray-500) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }

.loading-spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--gray-200); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================
   分页组件
   ================================================ */
.pagination { display: flex; justify-content: center; padding: 16px; }
.pagination-wrap {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  justify-content: center;
}
.pagination-wrap .page-info {
  font-size: 12px; color: var(--gray-500); margin-right: 8px;
}
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  color: var(--gray-700); background: #fff; border: 1px solid var(--gray-200);
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.page-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); pointer-events: none; }
.page-ellipsis { display: inline-flex; align-items: center; padding: 0 4px; color: var(--gray-400); font-size:13px; }

/* ================================================
   Badge 徽章
   ================================================ */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.badge-success  { background: #dcfce7; color: #166534; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef9c3; color: #92400e; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-gray     { background: var(--gray-100); color: var(--gray-600); }
.badge-purple   { background: #f3e8ff; color: #7e22ce; }
.badge-orange   { background: #ffedd5; color: #9a3412; }

/* ================================================
   字典类型样式
   ================================================ */
.dict-type-item {
  display: block;
  padding: 10px 16px;
  color: var(--gray-700);
  font-size: 14px;
  text-decoration: none;
  border-radius: 6px;
  margin: 2px 8px;
  transition: all 0.2s;
}
.dict-type-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}
.dict-type-item.active {
  background: var(--primary);
  color: #fff;
}

/* ================================================
   Card 补充
   ================================================ */
.card-body { padding: 16px 20px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); margin: 0; }

/* ================================================
   Stat card (模块内统计)
   ================================================ */
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 12.5px; color: var(--gray-500); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--gray-800); line-height: 1.2; }

/* ================================================
   表单补充
   ================================================ */
.form-control:disabled, .form-control[readonly] {
  background: var(--gray-50); color: var(--gray-500); cursor: not-allowed;
}
label.required::after {
  content: ' *'; color: var(--danger); font-weight: 600;
}

/* ================================================
   Modal 补充
   ================================================ */
.modal-lg { max-width: 900px; }
.modal-sm { max-width: 440px; }

/* ================================================
   表格补充
   ================================================ */
.table-responsive { overflow-x: auto; }
.table tbody tr:last-child td { border-bottom: none; }
.text-center { text-align: center; }

/* ================================================
   按钮补充
   ================================================ */
.btn-outline {
  background: #fff; color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-info {
  background: var(--info); color: #fff; border: 1px solid var(--info);
}
.btn-info:hover { background: #0e7490; }

/* ================================================
   移动端补充
   ================================================ */
@media (max-width: 768px) {
  .modal-dialog { max-width: 95vw !important; margin: 10px auto; }
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; }
  .calendar-grid { font-size: 11px; }
  .cal-day { min-height: 70px; }
}

/* ================================================
   弹窗 - 兼容 .modal.show 方式 (新模块：schedule/exams/invoices等)
   与原有 .modal-overlay > .modal 结构共存
   ================================================ */
/* 顶层 .modal 作为全屏遮罩 */
div.modal {
  display: none; position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 1000;
  align-items: center; justify-content: center;
}
div.modal.show { display: flex; }
/* .modal-overlay 内部的 .modal 是白色容器（旧写法），不覆盖 */
.modal-overlay .modal {
  position: static; background: #fff;
  border-radius: 14px; width: 90%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
}
.modal-overlay .modal.modal-lg { max-width: 900px; }
.modal-overlay .modal.modal-sm { max-width: 440px; }
.modal-dialog {
  background: #fff; border-radius: 14px;
  width: 90%; max-width: 640px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalIn 0.2s ease;
  overflow: hidden;
}
.modal-dialog.modal-lg { max-width: 900px; }
.modal-dialog.modal-sm { max-width: 440px; }

/* ================================================
   考试管理表格优化
   ================================================ */
/* 考试管理表格列宽优化 */
.table.exams-table th:nth-child(1) { width: 20%; min-width: 200px; } /* 考试名称 */
.table.exams-table th:nth-child(2) { width: 80px; } /* 类型 */
.table.exams-table th:nth-child(3) { width: 15%; min-width: 150px; } /* 课程 */
.table.exams-table th:nth-child(4) { width: 100px; } /* 日期 */
.table.exams-table th:nth-child(5) { width: 120px; } /* 时间 */
.table.exams-table th:nth-child(6) { width: 120px; } /* 地点 */
.table.exams-table th:nth-child(7) { width: 100px; } /* 满分/及格 */
.table.exams-table th:nth-child(8) { width: 150px; } /* 参考/通过 */
.table.exams-table th:nth-child(9) { width: 80px; } /* 状态 */
.table.exams-table th:nth-child(10) { width: 200px; white-space: nowrap; } /* 操作 */

/* 排课/课表表格列宽优化 */
.table.schedule-table th:nth-child(1) { width: 100px; } /* 日期 */
.table.schedule-table th:nth-child(2) { width: 120px; } /* 时间 */
.table.schedule-table th:nth-child(3) { width: 15%; min-width: 150px; } /* 课程 */
.table.schedule-table th:nth-child(4) { width: 20%; min-width: 200px; } /* 主题/内容 */
.table.schedule-table th:nth-child(5) { width: 120px; } /* 教室 */
.table.schedule-table th:nth-child(6) { width: 100px; } /* 教师 */
.table.schedule-table th:nth-child(7) { width: 80px; } /* 状态 */
.table.schedule-table th:nth-child(8) { width: 280px; white-space: nowrap; } /* 操作 */

/* 确保操作按钮不换行 */
.table.exams-table td:nth-child(10) { white-space: nowrap; }

/* 长文本自动换行 */
.table.exams-table td:nth-child(1),
.table.exams-table td:nth-child(3),
.table.exams-table td:nth-child(6) {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* 排课表格优化 */
.table.schedule-table td:nth-child(8) { white-space: nowrap; } /* 操作列不换行 */
.table.schedule-table td:nth-child(4) { /* 主题/内容自动换行 */
    word-break: break-word;
    overflow-wrap: break-word;
}
.table.schedule-table td:nth-child(3) { /* 课程名称 */
    word-break: break-word;
    overflow-wrap: break-word;
    font-weight: 600;
}

/* 调整操作按钮间距 */
.table.exams-table td:nth-child(10) .btn {
    margin: 2px;
    padding: 4px 8px;
    font-size: 12px;
}

/* 确保表格响应式 */
@media (max-width: 1200px) {
    .table.exams-table th:nth-child(6), /* 地点 */
    .table.exams-table td:nth-child(6) {
        display: none; /* 在小屏幕上隐藏地点列 */
    }
    /* 排课表格在小屏幕隐藏部分列 */
    .table.schedule-table th:nth-child(5), /* 教室 */
    .table.schedule-table td:nth-child(5) {
        display: none;
    }
}

@media (max-width: 1000px) {
    .table.exams-table th:nth-child(3), /* 课程 */
    .table.exams-table td:nth-child(3),
    .table.exams-table th:nth-child(5), /* 时间 */
    .table.exams-table td:nth-child(5) {
        display: none; /* 在更小屏幕上隐藏课程和时间列 */
    }
    /* 排课表格在更小屏幕隐藏更多列 */
    .table.schedule-table th:nth-child(4), /* 主题/内容 */
    .table.schedule-table td:nth-child(4),
    .table.schedule-table th:nth-child(6), /* 教师 */
    .table.schedule-table td:nth-child(6) {
        display: none;
    }
    .table.schedule-table th:nth-child(8) { /* 操作列缩小 */
        width: 200px;
    }
}

/* 通用表格对齐优化 */
.table th {
    white-space: nowrap;
}

.table td {
    vertical-align: top;
    word-break: break-word;
}

/* 操作列按钮组优化 */
.table td:last-child {
    white-space: nowrap;
    min-width: 180px;
}

/* 按钮组间距优化 */
.table td:last-child .btn {
    margin: 1px 2px;
    vertical-align: middle;
}




