/* ============================================
   班委工作台 - 全局样式
   ============================================ */

/* ===== CSS Variables ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #6366f1;
  --info-bg: #eef2ff;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;

  --sidebar-bg: #1e293b;
  --sidebar-surface: #334155;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #3b82f6;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --transition: all 0.2s ease;
}

/* ===== Reset ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

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

/* ===== Layout ===== */
#app {
  display: flex;
  height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 100;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-surface);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  line-height: 1;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.logo-text p {
  font-size: 11px;
  color: var(--sidebar-text);
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--sidebar-surface);
  border-radius: 4px;
}

.nav-group {
  margin-bottom: 8px;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  user-select: none;
}

.nav-item:hover {
  background: var(--sidebar-surface);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-accent);
  color: #fff;
  font-weight: 500;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-surface);
}

.class-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.class-badge {
  background: var(--sidebar-accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.class-name {
  color: var(--sidebar-text);
  font-size: 13px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  background: var(--surface);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 10;
}

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

.top-bar-left h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.module-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: var(--surface-alt);
  color: var(--text);
}

/* ===== 顶部云端同步状态按钮 ===== */
.cloud-sync-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  border: none;
  background: var(--surface-alt, #f1f5f9);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-right: 10px;
  transition: background .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.cloud-sync-btn:active { transform: scale(0.92); }
.cloud-sync-btn.is-ok { background: #ecfdf5; }
.cloud-sync-btn.is-busy {
  background: #eff6ff;
  animation: cloud-spin 1.1s linear infinite;
}
.cloud-sync-btn.is-warn { background: #fff7ed; }
@keyframes cloud-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.date-display {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-info {
  background: var(--info);
  color: #fff;
}

.btn-info:hover {
  background: #4f46e5;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 15px;
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.btn-icon.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ===== Action Bar ===== */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.action-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 240px;
  font-family: inherit;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

/* ===== Table ===== */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

/* 长文本单元格自动省略，防止撑开列宽 */
table.data-table td {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* 操作列固定宽度并 sticky 在右侧，滚动时始终可见 */
table.data-table th:last-child,
table.data-table td:last-child {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -2px 0 6px rgba(0,0,0,0.05);
  text-align: center;
  z-index: 2;
}

table.data-table thead th:last-child {
  z-index: 3;
  background: var(--surface-alt);
}

table.data-table tbody tr:hover td:last-child {
  background: var(--surface-alt);
}

table.data-table thead {
  background: var(--surface-alt);
}

table.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

table.data-table tbody tr {
  transition: var(--transition);
}

table.data-table tbody tr:hover {
  background: var(--surface-alt);
}

table.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  gap: 4px;
  white-space: nowrap;
  justify-content: center;
}

.data-table th input[type="checkbox"],
.data-table td input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.data-table tbody tr.selected-row {
  background: var(--primary-bg);
}

.data-table tbody tr.selected-row:hover {
  background: #dbeafe;
}

.btn-icon.eye {
  color: var(--info);
}

.btn-icon.eye:hover {
  background: var(--info-bg);
  color: var(--info);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 15px;
}

/* ===== Tags / Badges ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.tag-success { background: var(--success-bg); color: var(--success); }
.tag-warning { background: var(--warning-bg); color: var(--warning); }
.tag-danger { background: var(--danger-bg); color: var(--danger); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-primary { background: var(--primary-bg); color: var(--primary); }

/* ===== Dashboard ===== */
.dashboard-hero {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: 15%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.dashboard-hero h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.dashboard-hero p {
  font-size: 15px;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ===== Access Info Card (手机/微信访问) ===== */
.access-info-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.access-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}

.access-icon {
  font-size: 28px;
  line-height: 1;
}

.access-title {
  font-weight: 700;
  color: #065f46;
  font-size: 15px;
}

.access-desc {
  font-size: 13px;
  color: #047857;
  margin-top: 2px;
}

.access-info-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.access-url {
  background: #fff;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  color: #059669;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #a7f3d0;
  word-break: break-all;
  max-width: 320px;
}

.access-url:hover {
  background: #f0fdf4;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-info h3 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.module-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.module-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--primary);
}

.module-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.module-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.module-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.module-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.module-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-light);
}

.module-card-footer .record-count {
  font-weight: 600;
  color: var(--primary);
}

/* ===== Schedule Grid ===== */
.schedule-grid {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.schedule-table th,
.schedule-table td {
  border: 1px solid var(--border);
  padding: 0;
  text-align: center;
}

.schedule-table th {
  background: var(--primary);
  color: #fff;
  padding: 12px 8px;
  font-weight: 600;
  font-size: 14px;
}

.schedule-table .period-cell {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 16px 8px;
  width: 80px;
}

.schedule-cell {
  padding: 8px;
  min-height: 60px;
  cursor: pointer;
  transition: var(--transition);
  vertical-align: top;
}

.schedule-cell:hover {
  background: var(--primary-bg);
}

.schedule-cell.has-class {
  background: var(--primary-bg);
}

.schedule-cell.has-class.big-class {
  background: linear-gradient(135deg, var(--primary-bg), #dbeafe);
  border: 1.5px solid var(--primary);
  position: relative;
  vertical-align: middle;
}

.schedule-cell .big-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 4px;
  line-height: 1.5;
}

.schedule-cell .subject {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
}

.schedule-cell .teacher {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.schedule-cell .location {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 1px;
}

.schedule-cell.empty {
  color: var(--text-light);
  font-size: 12px;
}

/* ===== Schedule Confirm (识别结果确认) ===== */
.schedule-confirm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 12px;
}

.schedule-confirm-table th,
.schedule-confirm-table td {
  border: 1px solid var(--border);
  padding: 3px;
  text-align: center;
}

.schedule-confirm-table th {
  background: var(--primary);
  color: #fff;
  padding: 8px 4px;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.schedule-confirm-table .period-cell {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 4px;
  width: 76px;
  white-space: nowrap;
}

.sched-confirm-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 5px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  min-height: 34px;
  text-align: center;
}

.sched-confirm-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

.sched-confirm-input::placeholder {
  color: var(--text-light);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--surface-alt);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ===== Confirm Dialog ===== */
.confirm-dialog {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.confirm-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.confirm-dialog h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-dialog p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

.confirm-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--primary);
}

@keyframes toastIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast .toast-icon {
  font-size: 20px;
}

.toast .toast-message {
  font-size: 14px;
  color: var(--text);
}

/* ===== File Center ===== */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.file-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateX(4px);
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: var(--success-bg);
}

.file-icon.excel { background: var(--success-bg); }
.file-icon.word { background: var(--info-bg); }

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== Format Selector (Export/Import) ===== */
.format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.format-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
}

.format-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.format-card .format-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.format-card .format-info {
  flex: 1;
  min-width: 0;
}

.format-card .format-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.format-card .format-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.format-hint {
  margin-top: 16px;
  padding: 12px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary);
  line-height: 1.5;
}

/* ===== Settings ===== */
.settings-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row label {
  font-size: 14px;
  color: var(--text);
}

.settings-row .settings-value {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content-area {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .search-box input {
    width: 100%;
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ===== Selection Badge ===== */
.selection-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  padding: 0 5px;
  background: #fff;
  color: var(--success);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--success);
  line-height: 1;
}

.selection-badge.hidden {
  display: none;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ============================================================
   Mobile Responsive (PWA 手机端适配)
   屏幕宽度 <= 768px 时启用：侧边栏变为抽屉式、内容全宽、
   弹窗全屏化、表格横向滚动、操作栏纵向排列
   ============================================================ */
@media (max-width: 768px) {
  /* 移动端：解除 html/body 高度锁定，让页面自然滚动（桌面版保持原样） */
  html, body {
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
  }

  #app {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  /* 侧边栏：抽屉式（默认隐藏在左侧，点击汉堡滑出） */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  /* 桌面端 collapsed 状态在移动端不生效 */
  .sidebar.collapsed {
    width: 280px;
    min-width: 280px;
    overflow: visible;
  }
  /* 移动端遮罩层 */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* 主内容：随页面自然滚动（不再锁定高度，解决手机无法滑动问题） */
  .main-content {
    width: 100%;
    min-height: 100dvh;
    overflow: visible;
  }

  /* 顶栏精简 + 吸顶 */
  .top-bar {
    padding: 12px 14px;
    position: sticky;
    top: 0;
    z-index: 90;
    background: var(--bg, #f8fafc);
    border-bottom: 1px solid var(--border, #e2e8f0);
  }
  .top-bar-left h2 {
    font-size: 17px;
  }
  .date-display {
    display: none;
  }

  /* 内容区 */
  .content-area {
    padding: 14px 12px 60px;
  }

  /* 表格：横向滚动 + 固定表头 */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    border-radius: 10px;
  }
  .table-wrapper {
    min-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* 关键修复：手机端表格按内容宽度渲染（table-layout:auto + width:max-content），
     th 的 min-width 生效，列宽不再被压缩；超出容器时横向滚动 */
  table.data-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }
  .data-table {
    font-size: 13px;
  }
  .data-table th,
  .data-table td {
    padding: 10px 10px;
    white-space: nowrap;
  }

  /* 操作栏纵向排列，按钮撑满 */
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .action-bar-left,
  .action-bar-right {
    flex-wrap: wrap;
    width: 100%;
  }
  .action-bar .btn {
    flex: 1;
    min-width: 90px;
    padding: 10px 12px;
    font-size: 13px;
  }

  /* 搜索框 */
  .search-box {
    width: 100%;
  }
  .search-box input {
    width: 100%;
  }

  /* 弹窗：全屏化 */
  .modal-overlay {
    align-items: flex-end;
    justify-content: center;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }
  .modal-body {
    max-height: 62vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }
  .modal-footer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  /* 确认弹窗 */
  .confirm-dialog {
    width: 90%;
    max-width: 340px;
  }

  /* 文件列表 */
  .file-item {
    padding: 12px;
    gap: 10px;
  }
  .file-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .file-actions .btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* 格式卡片网格：单列 */
  .format-grid {
    grid-template-columns: 1fr;
  }

  /* 表单 */
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-group label {
    font-size: 13px;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* 防止 iOS 聚焦缩放 */
    padding: 10px 12px;
  }

  /* 仪表盘卡片 */
  .dashboard-hero {
    padding: 18px;
  }
  .dashboard-hero h2 {
    font-size: 20px;
  }
  .stat-card {
    padding: 14px;
  }

  /* 详情弹窗字段表 */
  .modal-body table td {
    font-size: 13px;
    padding: 8px 10px !important;
  }

  /* 课表：适配手机宽度 */
  .schedule-table {
    min-width: 760px;
    width: max-content;
  }
  .schedule-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    width: 100%;
  }

  /* Toast 提示：底部固定，绝不遮挡点击（避免 top+bottom+left+right 拉伸成满屏遮罩） */
  .toast-container {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: auto;
    pointer-events: none;
  }
  .toast {
    pointer-events: auto;
  }
}
