/* ========== CSS Variables ========== */
:root {
  --primary: #6B1F2A;
  --primary-hover: #5A1822;
  --primary-active: #4A121A;
  --primary-hover-bg: #F3E8E8;
  --surface: #FDF8F6;
  --background: #F5E6E0;
  --border: #E3D5CD;
  --text-primary: #4A1A22;
  --text-secondary: #7A4F50;
  --text-tertiary: #947373;
  --text-inverse: #FFFFFF;
  --disabled-bg: #C9B3A8;
  --shadow: rgba(107, 31, 42, 0.08);
  --wechat-green: #07C160;
  --danger: #D9363E;
  --success: #52C41A;
  --warning: #FAAD14;
  --info: #1890FF;
  --rose-light: #FFF0F0;

  --font-serif: "Noto Serif SC", "Songti SC", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
}

/* ========== Reset & Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-serif);
  color: var(--text-primary);
  background: var(--background);
  min-height: 100vh;
  overflow-x: hidden;
}
input, button, select, textarea {
  font-family: var(--font-serif);
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ========== Utility ========== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 20px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--text-inverse); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--primary-hover-bg); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--primary-hover-bg); }
.btn-danger { background: var(--danger); color: var(--text-inverse); }
.btn-danger:hover { background: #C22B33; }
.btn-wechat { background: var(--wechat-green); color: var(--text-inverse); }
.btn-wechat:hover { background: #06AD56; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Inputs ========== */
.form-group { display: flex; flex-direction: column; gap: var(--space-sm); }
.form-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-input::placeholder { color: var(--text-tertiary); }
select.form-input { cursor: pointer; }

/* ========== Cards ========== */
.card { background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 2px 12px var(--shadow); overflow: hidden; }
.card-body { padding: var(--space-xl); }

/* ========== Tags ========== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  height: 24px;
}
.tag-primary { background: var(--primary); color: var(--text-inverse); }
.tag-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.tag-rose { background: var(--rose-light); color: var(--primary); }
.tag-success { background: #F6FFED; color: #389E0D; border: 1px solid #B7EB8F; }

/* ========== App Layout ========== */
.app { min-height: 100vh; }

/* ========== Auth Pages (Login/Register) ========== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-xl);
  background: var(--background);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px var(--shadow);
  padding: var(--space-3xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}
.auth-logo { width: 80px; height: auto; margin-bottom: var(--space-sm); }
.auth-brand { font-size: 28px; font-weight: 700; color: var(--text-primary); letter-spacing: 2px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: -8px; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: var(--space-lg); }
.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-tertiary);
  font-size: 13px;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-footer { font-size: 13px; color: var(--text-tertiary); }

/* Role selector on login */
.role-selector {
  display: flex;
  gap: var(--space-xs);
  background: var(--background);
  border-radius: var(--radius-lg);
  padding: 4px;
  width: 100%;
}
.role-option {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.role-option:hover { color: var(--primary); }
.role-option.active { background: var(--surface); color: var(--primary); border-color: var(--border); box-shadow: 0 1px 4px var(--shadow); }

/* ========== Admin Layout ========== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
}
.sidebar-brand {
  padding: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img { width: 32px; height: 32px; }
.sidebar-brand span { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.sidebar-nav { flex: 1; padding: var(--space-md) 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-xl);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--primary-hover-bg); color: var(--primary); }
.sidebar-item.active { background: var(--primary-hover-bg); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: var(--space-lg) var(--space-xl); border-top: 1px solid var(--border); font-size: 12px; color: var(--text-tertiary); }

.main-content { flex: 1; margin-left: 200px; min-height: 100vh; background: var(--background); display: flex; flex-direction: column; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-2xl);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-header-actions { display: flex; align-items: center; gap: var(--space-md); }
.user-badge {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 4px 12px; background: var(--primary); color: var(--text-inverse);
  border-radius: var(--radius-full); font-size: 12px; font-weight: 600;
}
.user-badge.viewer { background: var(--text-secondary); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-secondary);
}

.page-body { flex: 1; padding: var(--space-xl) var(--space-2xl); overflow-y: auto; padding-bottom: 50px; }

/* ========== Stats Cards ========== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-lg); margin-bottom: var(--space-xl); }
.stat-card { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-lg); box-shadow: 0 2px 8px var(--shadow); text-align: center; }
.stat-value { font-family: var(--font-sans); font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: var(--space-xs); }

/* ========== Search & Filter Bar ========== */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); margin-bottom: var(--space-xl); flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: var(--space-md); flex: 1; flex-wrap: wrap; }
.search-box { position: relative; width: 320px; max-width: 100%; }
.search-box input { width: 100%; padding: 8px 14px 8px 36px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); font-size: 13px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-tertiary); }
.filter-group { display: flex; align-items: center; gap: var(--space-sm); }
.filter-select { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.toolbar-actions { display: flex; align-items: center; gap: var(--space-sm); }

/* ========== Data Table ========== */
.data-table-wrapper { background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 2px 8px var(--shadow); overflow: hidden; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.data-table th { background: #FAF5F3; font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tr:hover td { background: var(--primary-hover-bg); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .cell-name { font-weight: 600; color: var(--text-primary); cursor: pointer; }
.data-table tr.row-clickable { cursor: pointer; }
.data-table tr.row-clickable:hover td { background: var(--primary-hover-bg); }
.data-table .cell-wxid { color: var(--text-secondary); font-family: var(--font-sans); }
.data-table .cell-amount { font-family: var(--font-sans); font-weight: 600; color: var(--primary); }
.data-table .col-check { width: 40px; text-align: center; }
.data-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.empty-row td { text-align: center; color: var(--text-tertiary); padding: 40px 0; }

/* ========== Pagination ========== */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-sm); padding: var(--space-lg); }
.pagination button { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 13px; }
.pagination button.active { background: var(--primary); color: var(--text-inverse); border-color: var(--primary); }
.pagination button:hover:not(.active):not(:disabled) { background: var(--primary-hover-bg); }

/* ========== Detail Page ========== */
.detail-header {
  display: flex; align-items: flex-start; gap: var(--space-xl);
  margin-bottom: var(--space-lg); padding: var(--space-xl);
  background: var(--surface); border-radius: var(--radius-xl);
  border: 1px solid var(--border); box-shadow: 0 1px 4px var(--shadow);
}
.detail-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-hover-bg); display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: var(--primary); flex-shrink: 0;
}
.detail-info-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-md); }
.detail-name-row {
  display: flex; align-items: center; gap: var(--space-lg); flex-wrap: wrap;
}
.detail-name-row h2 { font-size: 22px; font-weight: 700; margin: 0; color: var(--text-primary); }
.detail-meta {
  display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap;
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
}
.detail-meta span { display: inline-flex; align-items: center; gap: var(--space-xs); }
.detail-meta .label { color: var(--text-tertiary); white-space: nowrap; }
.detail-meta .value { color: var(--text-primary); font-weight: 500; }
.meta-split { width: 1px; height: 14px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

.detail-actions {
  display: flex; align-items: center; gap: var(--space-sm);
  margin-bottom: var(--space-xl); flex-wrap: wrap;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.detail-section { margin-bottom: var(--space-xl); }
.section-title {
  display: flex; align-items: center; gap: var(--space-sm);
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  margin-bottom: var(--space-lg); padding-bottom: var(--space-sm); border-bottom: 2px solid var(--primary);
}
.section-title::before { content: ""; width: 4px; height: 18px; background: var(--primary); border-radius: 2px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-lg); }
.info-item { display: flex; flex-direction: column; gap: var(--space-xs); }
.info-item .label { font-size: 12px; color: var(--text-tertiary); }
.info-item .value { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.info-item .value-input { font-size: 14px; color: var(--text-primary); font-weight: 500; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--surface); width: 100%; }

.detail-card { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-xl); box-shadow: 0 2px 8px var(--shadow); margin-bottom: var(--space-xl); }

/* Tabs */
.tabs { display: flex; gap: var(--space-xs); border-bottom: 1px solid var(--border); margin-bottom: var(--space-xl); flex-wrap: wrap; }
.tab { padding: 10px 20px; font-size: 14px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.2s; font-weight: 500; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ========== Entry Form Pages ========== */
.entry-tabs { display: flex; gap: var(--space-sm); margin-bottom: var(--space-xl); }
.entry-tab {
  padding: 8px 20px; border-radius: var(--radius-lg); font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); transition: all 0.2s;
}
.entry-tab:hover { border-color: var(--primary); color: var(--primary); }
.entry-tab.active { background: var(--primary); color: var(--text-inverse); border-color: var(--primary); }
.entry-tab.active.rose { background: var(--primary); }

.form-section { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-xl); box-shadow: 0 2px 8px var(--shadow); margin-bottom: var(--space-xl); }
.form-section.rose-bg { background: var(--rose-light); }
.form-section-title { display: flex; align-items: center; gap: var(--space-sm); font-size: 15px; font-weight: 700; margin-bottom: var(--space-lg); color: var(--text-primary); }
.form-section-title .num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--text-inverse); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); margin-bottom: var(--space-lg); }
.form-row:last-child { margin-bottom: 0; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-md); margin-top: var(--space-xl); }

/* ========== Import Page ========== */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-xl);
  padding: var(--space-3xl); text-align: center; background: var(--surface);
  transition: all 0.2s; cursor: pointer;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-hover-bg); }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-hover-bg); }
.upload-zone svg { width: 48px; height: 48px; color: var(--primary); margin: 0 auto var(--space-md); }
.upload-zone h3 { font-size: 18px; font-weight: 600; margin-bottom: var(--space-sm); }
.upload-zone p { font-size: 13px; color: var(--text-secondary); }
.upload-zone .upload-hint { font-size: 12px; color: var(--text-tertiary); margin-top: var(--space-md); }
.upload-zone input[type="file"] { display: none; }

.template-row { display: flex; align-items: center; gap: var(--space-lg); margin-top: var(--space-xl); flex-wrap: wrap; }
.template-label { font-size: 13px; color: var(--text-secondary); }

/* ========== Import Preview Page ========== */
.preview-banner { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-lg) var(--space-xl); background: #F6FFED; border: 1px solid #B7EB8F; border-radius: var(--radius-xl); margin-bottom: var(--space-xl); }
.preview-banner.error { background: #FFF1F0; border-color: #FFCCC7; }
.preview-banner svg { width: 24px; height: 24px; color: #52C41A; flex-shrink: 0; }
.preview-banner.error svg { color: var(--danger); }
.preview-banner h3 { font-size: 16px; font-weight: 600; color: #389E0D; }
.preview-banner.error h3 { color: var(--danger); }
.preview-banner p { font-size: 13px; color: #389E0D; opacity: 0.8; }
.preview-banner.error p { color: var(--danger); }

.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); margin-bottom: var(--space-xl); }
.preview-stat { background: var(--surface); border-radius: var(--radius-xl); padding: var(--space-xl); box-shadow: 0 2px 8px var(--shadow); text-align: center; }
.preview-stat .num { font-family: var(--font-sans); font-size: 36px; font-weight: 700; color: var(--primary); }
.preview-stat .label { font-size: 13px; color: var(--text-secondary); margin-top: var(--space-xs); }

.mapping-list { background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 2px 8px var(--shadow); overflow: hidden; }
.mapping-item { display: flex; align-items: center; padding: 12px var(--space-xl); border-bottom: 1px solid var(--border); font-size: 14px; }
.mapping-item:last-child { border-bottom: none; }
.mapping-item .source { color: var(--text-secondary); width: 200px; flex-shrink: 0; }
.mapping-item .arrow { color: var(--text-tertiary); margin: 0 var(--space-md); }
.mapping-item .target { color: var(--primary); font-weight: 600; }

/* ========== Modal ========== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  opacity: 0; visibility: hidden; transition: all 0.3s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 16px 48px rgba(0,0,0,0.15);
  width: 100%; max-width: 440px; padding: var(--space-2xl); position: relative;
  transform: translateY(-20px); transition: transform 0.3s; max-height: 90vh; overflow-y: auto;
}
.modal-overlay.show .modal-card { transform: translateY(0); }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--primary-hover-bg); color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.modal-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: var(--space-sm); }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: var(--space-xl); }
.modal-qr {
  width: 200px; height: 200px; margin: 0 auto var(--space-lg); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-tertiary);
  overflow: hidden; padding: 0;
}
.modal-qr img { display: block; width: 200px; height: 200px; }
.qr-status { text-align: center; font-size: 13px; color: var(--primary); margin-bottom: var(--space-lg); min-height: 19px; font-weight: 500; }
.dev-qr-note { width: 200px; height: 200px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-tertiary); font-size: 14px; line-height: 1.7; padding: 22px; }
.dev-qr-footnote { text-align: center; font-size: 11px; color: #8A7A76; margin-bottom: var(--space-lg); line-height: 1.5; }
.modal-actions { display: flex; gap: var(--space-md); margin-top: var(--space-xl); }
.modal-actions .btn { flex: 1; }
.modal-student-card { background: var(--primary-hover-bg); border-radius: 12px; padding: 16px; margin: 16px 0; display: flex; align-items: center; gap: 12px; }
.modal-student-card .avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; flex-shrink: 0; }

.qr-modal .modal-card { max-width: 400px; }
.qr-hint { text-align: center; font-size: 13px; color: var(--text-secondary); margin-bottom: var(--space-lg); }

/* ========== Follow-up Calendar Modal ========== */
.calendar-card { max-width: 480px; padding: var(--space-xl); }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-lg); }
.cal-arrow {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.cal-arrow:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-hover-bg); }
.cal-title-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cal-title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: var(--text-primary); }
.cal-student-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px;
  border-radius: var(--radius-full); background: var(--rose-light); color: var(--primary);
  font-size: 11px; font-weight: 500;
}
.cal-tag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.cal-stats { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-lg); }
.cal-stat { display: flex; flex-direction: column; gap: 2px; }
.cal-stat-right { align-items: flex-end; text-align: right; }
.cal-stat-val { font-family: var(--font-sans); font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.cal-stat-label { font-size: 11px; color: var(--text-tertiary); }

.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-wk { text-align: center; font-size: 11px; font-weight: 500; color: var(--text-tertiary); padding: 4px 0; }
.cal-wk.wk-end { color: var(--text-tertiary); opacity: 0.7; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--surface); border: 1px solid transparent; transition: all 0.15s;
}
.cal-cell.empty { background: transparent; cursor: default; border: none; }
.cal-cell:not(.empty):hover { border-color: var(--primary); }
.cal-num { font-family: var(--font-sans); font-size: 13px; color: var(--text-secondary); }
.cal-cell.has-log { background: var(--rose-light); }
.cal-cell.has-log .cal-num { color: var(--primary); font-weight: 600; }
.cal-cell.today { background: var(--primary); }
.cal-cell.today .cal-num { color: #fff; font-weight: 700; }
.cal-cell.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-hover-bg); }
.cal-dot {
  position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}
.cal-cell.today .cal-dot { background: #fff; }
.cal-cell.empty .cal-dot { display: none; }

.cal-legend { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: var(--space-md); }
.cal-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-tertiary); }
.cal-leg-dot { width: 8px; height: 8px; border-radius: 50%; }
.cal-leg-dot.has { background: var(--primary); }
.cal-leg-dot.today { background: var(--primary); }
.cal-leg-dot.none { background: transparent; border: 1px solid var(--border); }

.cal-detail { margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: 1px solid var(--border); }
.cal-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-md); }
.cal-detail-date { font-family: var(--font-serif); font-size: 13px; font-weight: 700; color: var(--text-primary); }
.cal-detail-empty { padding: var(--space-lg); text-align: center; color: var(--text-tertiary); font-size: 13px; background: var(--primary-hover-bg); border-radius: var(--radius-lg); }
.cal-detail-empty.small { padding: var(--space-md); }

.cal-log-item { padding: 12px; border-radius: var(--radius-lg); background: var(--primary-hover-bg); margin-bottom: var(--space-sm); }
.cal-log-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-log-type { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--radius-sm); background: var(--rose-light); color: var(--primary); font-size: 10px; font-weight: 500; }
.cal-log-time { font-family: var(--font-sans); font-size: 10px; color: var(--text-tertiary); }
.cal-log-content { font-size: 13px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.cal-log-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 8px; }
.cal-log-edit, .cal-log-del { font-size: 11px; cursor: pointer; }
.cal-log-edit { color: var(--primary); }
.cal-log-del { color: var(--danger); }

.cal-log-form { padding: 12px; border-radius: var(--radius-lg); background: var(--primary-hover-bg); margin-bottom: var(--space-sm); display: flex; flex-direction: column; gap: 8px; }
.cal-form-type { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; color: var(--text-primary); cursor: pointer; }
.cal-form-content { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; color: var(--text-primary); font-family: var(--font-serif); resize: vertical; }
.cal-form-content:focus, .cal-form-type:focus { outline: none; border-color: var(--primary); }
.cal-form-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); }

/* ========== Placeholder / Lock State ========== */
.placeholder-card { border: 2px dashed var(--border); border-radius: var(--radius-xl); padding: var(--space-3xl); text-align: center; color: var(--text-tertiary); }
.placeholder-card svg { width: 40px; height: 40px; margin: 0 auto var(--space-md); color: var(--border); }
.placeholder-card h4 { font-size: 15px; font-weight: 600; margin-bottom: var(--space-sm); color: var(--text-secondary); }
.placeholder-card p { font-size: 13px; }

/* ========== Toast ========== */
.toast-container { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--text-primary); color: #fff; padding: 10px 20px; border-radius: var(--radius-lg);
  font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); opacity: 0; transform: translateY(-10px);
  transition: all 0.3s; display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #389E0D; }
.toast.error { background: var(--danger); }

/* ========== Page Transitions ========== */
.page-view { display: none; }
.page-view.active { display: flex; flex-direction: column; min-height: 100vh; }

/* ========== 列表统计栏 · 可点击筛选 ========== */
.stat-card.clickable { cursor: pointer; transition: all 0.18s; user-select: none; }
.stat-card.clickable:hover { border-color: var(--primary); box-shadow: 0 4px 16px var(--shadow); transform: translateY(-2px); }
.stat-card.clickable:active { transform: translateY(0); }
.stat-card.active { background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 16px var(--shadow); }
.stat-card.active .stat-value,
.stat-card.active .stat-label { color: var(--text-inverse); }

/* ========== 详情头部 · 消费总金额胶囊 ========== */
.cons-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  background: #FFF; border: 1.5px solid var(--primary);
  border-radius: var(--radius-full); cursor: pointer; transition: all 0.2s;
  flex-shrink: 0; box-shadow: 0 1px 4px rgba(107,31,42,0.08);
}
.cons-chip:hover { border-color: var(--primary); background: var(--primary-hover-bg); box-shadow: 0 2px 8px rgba(107,31,42,0.15); transform: translateY(-1px); }
.cons-chip:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-hover-bg), 0 2px 8px rgba(107,31,42,0.15); }
.cons-chip-label { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.cons-chip-amount { font-family: var(--font-sans); font-size: 20px; font-weight: 800; color: var(--primary); }
.cons-chip-hint { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

/* ========== 详情头部 · 剩余课时步进器（与消费胶囊并列） ========== */
.sess-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  background: #FFF; border: 1.5px solid var(--border);
  border-radius: var(--radius-full); flex-shrink: 0;
  box-shadow: 0 1px 4px var(--shadow);
}
.sess-chip-label { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.sess-stepper { display: inline-flex; align-items: center; gap: 4px; }
.sess-step-btn {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--primary); font-size: 16px; font-weight: 700; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.sess-step-btn:hover { border-color: var(--primary); background: var(--primary-hover-bg); }
.sess-step-btn:active { transform: scale(0.92); }
.sess-step-input {
  width: 40px; height: 26px; text-align: center;
  border: 1px solid var(--border); border-radius: 6px;
  font-family: var(--font-sans); font-size: 16px; font-weight: 800; color: var(--primary);
  background: #FFF; padding: 0; -moz-appearance: textfield;
}
.sess-step-input::-webkit-outer-spin-button,
.sess-step-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sess-step-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-hover-bg); }
.sess-chip-unit { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

/* ========== 消费台账弹窗 ========== */
.ledger-card { max-width: 480px; }
.ledger-list { max-height: 320px; overflow-y: auto; margin: var(--space-lg) 0; display: flex; flex-direction: column; gap: 8px; }
.ledger-empty { padding: var(--space-xl); text-align: center; font-size: 13px; color: var(--text-tertiary); background: var(--primary-hover-bg); border-radius: var(--radius-lg); }
.ledger-item {
  display: grid; grid-template-columns: 96px 110px 1fr auto; align-items: center; gap: var(--space-md);
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.ledger-item.is-editing { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-hover-bg); }
.ledger-item-date { font-family: var(--font-sans); font-size: 13px; color: var(--text-secondary); }
.ledger-item-amount { font-family: var(--font-sans); font-size: 15px; font-weight: 700; color: var(--primary); }
.ledger-item-note { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-item-actions { display: flex; gap: 6px; }
.ledger-total { color: var(--primary); font-size: 18px; }
.ledger-form { background: var(--primary-hover-bg); border-radius: var(--radius-lg); padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-sm); }
.ledger-form-row { display: flex; gap: var(--space-sm); }
.ledger-form-row .ledger-date { flex: 0 0 140px; }
.ledger-form-row .ledger-amount { flex: 1; }
.ledger-form-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); }

/* ========== 小按钮 ========== */
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-md); cursor: pointer; border: none; font-weight: 500; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.btn-danger-ghost:hover { background: #FCE9E9; border-color: var(--danger); }
.btn-ghost.btn-xs { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-ghost.btn-xs:hover { background: var(--primary-hover-bg); }
.page-view.admin-view.active { display: flex; flex-direction: row; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .form-row.three { grid-template-columns: 1fr; }
  .preview-stats { grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; align-items: center; text-align: center; padding: var(--space-lg); }
  .detail-info-col { align-items: center; }
  .detail-name-row { justify-content: center; }
  .detail-meta { justify-content: center; }
  .auth-card { padding: var(--space-xl); }
  .search-box { width: 100%; }
}

/* ========== 模块化数据结构（7 张 Excel 表 = 7 个模块） ========== */
/* 详情页：模块卡片 */
.detail-module {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  margin-bottom: var(--space-xl);
  background: var(--surface);
}
.detail-module > .section-title {
  margin: 0 0 var(--space-lg);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
}
.detail-subsection { margin-bottom: var(--space-lg); }
.detail-subsection:last-child { margin-bottom: 0; }
.subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 2px solid var(--primary);
}

/* 详情页：未解锁模块 */
.module-locked {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg);
  text-align: center;
}
.locked-head {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}
.locked-head svg { flex: none; color: var(--text-tertiary); }
.locked-desc { font-size: 12px; color: var(--text-tertiary); margin-bottom: var(--space-lg); }
.locked-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: var(--space-lg); }
.locked-mod-title {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-tertiary);
}
.locked-mod-title::before { content: '🔒'; font-size: 11px; }

/* 录入页：模块分块 */
.form-module {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-lg) var(--space-xl) var(--space-md);
  margin-bottom: var(--space-xl);
  background: var(--surface);
}
.form-module.rose-bg { background: var(--rose-bg); border-color: var(--rose-border); }
.form-module-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 700;
  margin-bottom: var(--space-lg);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mod-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
}
.mod-hint { font-size: 12px; font-weight: 400; color: var(--text-tertiary); }

/* 导入页：工作表 → 模块 对照 */
.mod-map {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-lg) var(--space-xl);
  margin-top: var(--space-xl);
  background: var(--surface);
}
.mod-map-head { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.mod-map-tip { display: block; font-size: 12px; font-weight: 400; color: var(--text-tertiary); margin-top: 4px; }
.mod-map-grid {
  display: grid; gap: 10px; margin-top: var(--space-lg);
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.mod-map-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
}
.mod-map-item.locked { border-style: dashed; background: var(--rose-bg); border-color: var(--rose-border); }
.mod-map-num {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
}
.mod-map-item.locked .mod-map-num { background: var(--text-tertiary); }
.mod-map-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.mod-map-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* 导入预览：模块标签 + 字段映射分组 */
.mod-chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--rose-bg); border: 1px solid var(--rose-border);
  color: var(--primary); font-size: 12px; white-space: nowrap;
}
.mod-chip.lg { padding: 6px 14px; font-size: 13px; font-weight: 600; }
.mod-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mapping-group { margin-bottom: var(--space-lg); }
.mapping-group-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--primary);
  margin-bottom: 8px;
}
.mapping-group-title .cnt {
  font-size: 11px; font-weight: 400; color: var(--text-tertiary);
  padding: 1px 8px; border-radius: 999px; background: var(--bg);
}

@media (max-width: 768px) {
  .detail-module, .form-module, .mod-map { padding-left: var(--space-lg); padding-right: var(--space-lg); }
  .mod-map-grid { grid-template-columns: 1fr; }
}

/* ========== 数据概览条 ========== */
.detail-overview { margin-bottom: var(--space-xl); }
.overview-strip {
  display: flex; gap: var(--space-xl); align-items: stretch; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius-xl); padding: var(--space-lg) var(--space-xl);
}
.ov-series-wrap { display: flex; gap: var(--space-xl); flex-wrap: wrap; flex: 1; min-width: 280px; }
.ov-series { min-width: 200px; }
.ov-series-cap { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 8px; letter-spacing: 0.5px; }
.ov-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ov-bar-label { font-size: 12px; color: var(--text-secondary); width: 40px; flex-shrink: 0; }
.ov-bar-track { flex: 1; height: 12px; background: #EDE0D9; border-radius: 999px; overflow: hidden; min-width: 80px; }
.ov-bar-fill { height: 100%; background: #C68A86; border-radius: 999px; }
.ov-bar-fill.is-current { background: var(--primary); }
.ov-bar-val { font-size: 12px; font-weight: 500; color: var(--text-primary); width: 56px; text-align: right; flex-shrink: 0; }
.ov-stats { display: flex; gap: var(--space-lg); align-items: center; border-left: 1px solid var(--border); padding-left: var(--space-xl); }
/* 5980（无跨年序列）：概览条只显示关键指标，撑满整条 */
.overview-strip.no-series .ov-series-wrap { display: none; }
.overview-strip.no-series .ov-stats { border-left: none; padding-left: 0; width: 100%; justify-content: flex-start; gap: var(--space-xxl); }
.ov-stat { text-align: center; }
.ov-stat-val { font-size: 22px; font-weight: 500; color: var(--primary); line-height: 1.1; }
.ov-stat-label { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* ========== 对照组件 ========== */
.muted { color: var(--text-tertiary); }
.cmp-series { margin-bottom: var(--space-md); }
.cmp-series:last-child { margin-bottom: 0; }
.cmp-series-cap { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 6px; letter-spacing: 0.5px; }
.cmp-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.cmp-bar-label { font-size: 12px; color: var(--text-secondary); width: 92px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-bar-track { flex: 1; height: 14px; background: #EDE0D9; border-radius: 4px; overflow: hidden; min-width: 60px; }
.cmp-bar-fill { height: 100%; background: #C68A86; border-radius: 4px; }
.cmp-bar-fill.is-current { background: var(--primary); }
.cmp-bar-val { font-size: 13px; font-weight: 500; color: var(--text-primary); width: 64px; text-align: right; flex-shrink: 0; }

.cmp-dist { margin-top: 2px; }
.cmp-dist-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; }
.cmp-dist-seg { height: 100%; }
.cmp-dist-legend-wrap { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.cmp-dist-legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-secondary); }
.cmp-dist-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.cmp-benchmark { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.cmp-bench-card { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-md); }
.cmp-bench-title { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.cmp-bench-body { font-size: 13px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; }

.cmp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-md); }
.cmp-card { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-md); }
.cmp-card-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 4px; }
.cmp-card-val { font-size: 13px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; }

.cmp-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-sm); }
.cmp-step { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-md); }
.cmp-step-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.cmp-step-label { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 4px; }
.cmp-step-val { font-size: 13px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; }

.cmp-chain { display: flex; flex-direction: column; }
.cmp-chain-item { position: relative; padding: 0 0 var(--space-md) var(--space-lg); border-left: 2px solid var(--border); }
.cmp-chain-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.cmp-chain-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.cmp-chain-label { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 3px; }
.cmp-chain-val { font-size: 13px; color: var(--text-primary); line-height: 1.6; white-space: pre-wrap; }

@media (max-width: 768px) {
  .ov-stats { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: var(--space-lg); width: 100%; justify-content: flex-start; }
  .cmp-benchmark { grid-template-columns: 1fr; }
  .cmp-steps { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 列表行内迷你趋势 ========== */
.cell-trend { text-align: center; vertical-align: middle; }
.lst-trend { display: inline-flex; align-items: flex-end; gap: 3px; height: 28px; }
.lst-bar { width: 9px; min-height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; opacity: 0.85; position: relative; display: inline-flex; align-items: flex-start; justify-content: center; }
.lst-bar i { font-style: normal; font-size: 9px; line-height: 1; color: var(--text-tertiary); transform: translateY(-11px); }
.lst-bar:hover { opacity: 1; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ========== 课程流水页 ========== */
.ledger-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ledger-subtabs { display: flex; gap: 8px; flex-wrap: wrap; }
.ledger-subtab {
  padding: 8px 18px; border-radius: 999px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.ledger-subtab.active { background: var(--primary); border-color: var(--primary); color: var(--text-inverse); font-weight: 600; }
.ledger-subtab.disabled { opacity: 0.5; cursor: not-allowed; }
.ledger-subtab.disabled:hover { background: var(--surface); border-color: var(--border); }
.ledger-toolbar-actions { display: flex; gap: 10px; flex-shrink: 0; }

.ledger-filterbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ledger-chips { display: flex; gap: 8px; }
.ledger-chip {
  padding: 6px 18px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); transition: all 0.15s;
}
.ledger-chip.active { background: var(--primary-hover-bg); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.ledger-student-filter { flex-shrink: 0; }
.ledger-student-select { width: auto; min-width: 150px; padding: 8px 12px; }

/* 课程流水检索栏 */
.ledger-search { position: relative; flex: 1; min-width: 220px; max-width: 360px; margin-left: auto; }
.ledger-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }
.ledger-search-input {
  width: 100%; padding: 8px 36px 8px 38px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 14px; color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.ledger-search-input::placeholder { color: var(--text-tertiary); }
.ledger-search-input:focus { outline: none; border-color: var(--primary); background: #FFF; box-shadow: 0 0 0 3px var(--primary-hover-bg); }
.ledger-search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: var(--border); color: var(--text-secondary);
  font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.ledger-search-clear:hover { background: var(--text-tertiary); color: #FFF; }

.ledger-table-wrap { background: #FFF; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; box-shadow: 0 1px 4px var(--shadow); }
.ledger-row {
  display: grid; gap: 12px; align-items: center; padding: 12px 16px;
  grid-template-columns: 72px 92px 96px 112px minmax(140px, 1fr) 132px 116px 110px 88px minmax(100px, 1fr) 124px;
  border-bottom: 1px solid var(--border); min-width: 1120px;
}
.lc-proj { color: var(--text-secondary) !important; font-size: 12px !important; font-weight: 600; }
.ledger-row:last-child { border-bottom: none; }
.ledger-head { font-size: 12px; color: var(--text-tertiary); font-weight: 700; background: var(--surface); position: sticky; top: 0; border-bottom: 2px solid var(--border); }
.ledger-row > div { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row .lc-type, .ledger-row .lc-amount, .ledger-row .lc-op { overflow: visible; }
.ledger-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-buy { background: var(--primary); color: #FFF; }
.badge-adj { background: #FBE9D0; color: #B26A00; }
.badge-init { background: var(--primary-hover-bg); color: var(--text-tertiary); }
.lc-amount { font-family: var(--font-sans); font-weight: 700; color: var(--primary); }
.lc-amount.neg { color: #2E7D32; }
.lc-sess { color: var(--text-tertiary); font-size: 12px; }
.lc-op { overflow: visible; }

/* ========== 详情头部 · 剩余课时（只读，来自流水） ========== */
.sess-chip { cursor: default; }
.sess-chip-amount { font-family: var(--font-sans); font-size: 20px; font-weight: 800; color: var(--primary); }

/* ========== 手动调整弹窗 ========== */
.adjust-current { background: var(--primary-hover-bg); border-radius: var(--radius-lg); padding: 14px 16px; font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.adjust-current b { color: var(--primary); font-family: var(--font-sans); }

/* ========== 详情页 · 过程留痕图片 ========== */
.detail-images { margin-top: var(--space-lg); background: #FFF; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: 0 1px 4px var(--shadow); }
.detail-images .section-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.img-thumb { position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-md); overflow: hidden; background: var(--surface); border: 1px solid var(--border); cursor: zoom-in; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .img-del { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #FFF; font-size: 14px; line-height: 20px; text-align: center; cursor: pointer; padding: 0; }
.img-thumb .img-note { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 11px; color: #FFF; background: linear-gradient(transparent, rgba(0,0,0,.6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-empty { color: var(--text-tertiary); font-size: 13px; padding: 18px 4px; }
.img-loading { color: var(--text-tertiary); font-size: 13px; padding: 18px 4px; }
.img-upload-row { margin-top: 12px; }
.img-lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 24px; }
.img-lightbox.hidden { display: none; }
.img-lightbox-inner { max-width: 92vw; max-height: 88vh; text-align: center; }
.img-lightbox-inner img { max-width: 92vw; max-height: 80vh; border-radius: 8px; }
.img-lightbox-cap { color: #EEE; font-size: 13px; margin-top: 10px; }

/* ========== 权限管理页 ========== */
.perm-table { display: flex; flex-direction: column; gap: 10px; }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.perm-name { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.perm-displayname { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.perm-username { font-size: 12px; color: var(--text-secondary); }
.perm-self { color: var(--primary); font-size: 12px; font-weight: 600; }
.perm-save { margin-left: auto; }
.perm-del { }

/* ========== 站点备案页脚 ========== */
.site-footer { 
  position: fixed; bottom: 0; left: 0; right: 0; 
  text-align: center; padding: 8px 16px; 
  font-size: 12px; color: var(--text-tertiary); 
  background: var(--surface); border-top: 1px solid var(--border); 
  z-index: 100; pointer-events: none;
}
.site-footer .footer-inner { display: flex; align-items: center; justify-content: center; gap: 16px; }
.site-footer a { color: var(--text-tertiary); text-decoration: none; pointer-events: auto; }
.site-footer a:hover { color: var(--primary); }

/* ========== 客资表（leads） ========== */
.dup-card-inner { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; margin: 8px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-width: 280px; text-align: left; }
.dup-row { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.dup-label { color: var(--text-secondary); min-width: 64px; }
.dup-value { color: var(--text-primary); font-weight: 500; }
.col-op a { color: var(--primary); text-decoration: none; }
.col-op a:hover { text-decoration: underline; }

/* ========== 学员合同（详情页顶部入口 + 弹窗） ========== */
/* 入口胶囊：与「消费总金额」胶囊并列，风格保持一致但为中性色 */
.contract-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: #FFF; border: 1.5px solid var(--border);
  border-radius: var(--radius-full); cursor: pointer; transition: all 0.2s;
  flex-shrink: 0; box-shadow: 0 1px 4px var(--shadow);
}
.contract-chip:hover { border-color: var(--primary); background: var(--primary-hover-bg); box-shadow: 0 2px 8px rgba(107,31,42,0.15); transform: translateY(-1px); }
.contract-chip:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-hover-bg); }
.contract-chip-icon { font-size: 15px; line-height: 1; }
.contract-chip-label { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.contract-chip-state { font-size: 13px; font-weight: 700; color: var(--text-tertiary); white-space: nowrap; }
.contract-chip-state.on { color: var(--primary); }

/* 弹窗主体 */
.contract-card { max-width: 560px; }
.contract-view { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.contract-thumb {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface); cursor: zoom-in;
  max-height: 52vh; display: flex; align-items: center; justify-content: center;
}
.contract-thumb img { width: 100%; height: auto; max-height: 52vh; object-fit: contain; display: block; }
.contract-thumb:hover { border-color: var(--primary); }
.contract-meta { font-size: 12px; color: var(--text-tertiary); text-align: center; }
.contract-ops { display: flex; gap: 10px; justify-content: center; }
.contract-zone { padding: var(--space-2xl) var(--space-xl); }
.contract-zone h3 { font-size: 16px; }
