/* 玻璃拟态卡片样式 - Apple/Ant-Design风格 */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

/* 一纸八用请假条打印样式 - 优化版（8张/A4，竖版portrait） */
.leave-ticket-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(4, 72mm);
  gap: 0;
  width: 210mm;
  height: 297mm;
  page-break-after: always;
}

.leave-ticket-item {
  width: 105mm;
  height: 72mm;
  border: 1px dashed #999;
  padding: 8px 10px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  background: white;
}

.leave-ticket-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='100'%3E%3Ctext x='50%25' y='50%25' font-family='SimSun' font-size='14' fill='%23f0f0f0' text-anchor='middle' dy='.3em' transform='rotate(-30 100 50)'%3E已核销%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
}

.leave-ticket-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5px;
}

.leave-ticket-header {
  text-align: center;
  border-bottom: 2px solid #333;
  padding-bottom: 5px;
  margin-bottom: 6px;
}

.leave-ticket-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin: 0;
  letter-spacing: 2px;
}

.leave-ticket-body {
  flex: 1;
  font-size: 12px;
  line-height: 1.8;
}

.leave-ticket-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 3px;
}

.leave-ticket-label {
  color: #555;
  min-width: 55px;
  flex-shrink: 0;
  font-size: 13px;
}

.leave-ticket-value {
  color: #222;
  font-weight: 600;
  flex: 1;
  font-size: 14px;
}

.leave-ticket-reason {
  margin-top: 5px;
  padding: 4px 6px;
  background: #fafafa;
  border-left: 3px solid #165DFF;
  border-radius: 2px;
  font-size: 16px;
  line-height: 1.6;
  color: #222;
  max-height: 80px;
  overflow: auto;
}

.leave-ticket-reason-greeting {
  font-weight: normal;
  color: #222;
  display: inline;
  margin-bottom: 0;
}

.leave-ticket-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 5px;
  padding-top: 3px;
  border-top: 1px solid #eee;
  min-height: 18mm;
}

.leave-ticket-signature {
  flex: 1;
  text-align: center;
}

.leave-ticket-signature img {
  max-width: 85px;
  max-height: 42px;
  display: block;
  margin: 0 auto;
}

.leave-ticket-date {
  font-size: 9px;
  color: #888;
  text-align: right;
  padding-right: 10px;
}

/* 斜杠表头样式 - 屏幕显示 */
th.corner-header {
  position: relative !important;
  padding: 0 !important;
  width: 50px !important;
  height: 28px !important;
  overflow: hidden !important;
  background: linear-gradient(to bottom left, transparent 48%, #000 48%, #000 52%, transparent 52%) !important;
}

th.corner-header .corner-top {
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 9px;
  z-index: 1;
}

th.corner-header .corner-bottom {
  position: absolute;
  bottom: 3px;
  left: 6px;
  font-size: 9px;
  z-index: 1;
}

/* ============================================
   教室触摸大屏适配 - 1080P分辨率优化
   适用场景：教室交互式智能平板、触控一体机
   特点：大尺寸屏幕、触摸操作、远距离观看
   特殊优化：鸿合HITeVision、希沃seewo等教育平板
   ============================================ */

/* 触摸设备检测 - 添加触摸反馈样式 */
@media (hover: none) and (pointer: coarse) {
  /* 全局允许滚动和缩放 */
  html, body {
    touch-action: pan-x pan-y pinch-zoom;
  }
  
  /* 防止长按选中 */
  body {
    -webkit-user-select: none;
    user-select: none;
  }
  
  /* 允许输入框选中 */
  input, textarea, select {
    -webkit-user-select: text;
    user-select: text;
  }
  
  /* 全局触摸优化 */
  * {
    -webkit-tap-highlight-color: rgba(22, 93, 255, 0.1);
  }
  
  /* 按钮触摸区域优化 */
  button,
  .silicone-btn,
  .mgmt-btn-card,
  [onclick] {
    min-height: 56px;
    min-width: 56px;
    cursor: pointer;
  }
  
  /* 触摸反馈动画 - 放大反馈效果，适合教室环境 */
  button:active,
  .silicone-btn:active,
  .mgmt-btn-card:active {
    transform: scale(0.92);
    opacity: 0.75;
    transition: all 0.1s ease;
  }
  
  /* 输入框触摸优化 - 防止鸿合浏览器缩放 */
  input,
  select,
  textarea {
    font-size: 16px !important; /* 防止iOS缩放 */
    min-height: 56px;
    padding: 14px 18px !important;
    border-width: 2px !important;
  }
}

/* 教室大屏适配 - 1080P及以上分辨率 */
@media screen and (min-width: 1920px) and (min-height: 1080px) {
  /* 基础字号放大 - 教室大屏推荐 18px-20px */
  html {
    font-size: 18px; 
  }
  
  /* 卡片间距增大 */
  .max-w-7xl {
    padding: 32px;
  }
  
  .space-y-6 > * + * {
    margin-top: 40px;
  }
  
  /* 标题字号放大 - 使用属性选择器匹配Tailwind任意值类 */
  [class*="text-[26px]"] {
    font-size: 36px !important;
  }
  
  [class*="text-[24px]"] {
    font-size: 32px !important;
  }
  
  [class*="text-[16px]"] {
    font-size: 22px !important;
  }
  
  /* 卡片内边距增大 - 更适合大屏展示 */
  .p-6 {
    padding: 40px !important;
  }
  
  .p-5 {
    padding: 32px !important;
  }
  
  .p-4 {
    padding: 28px !important;
  }
  
  /* 统计卡片数字放大 */
  .text-2xl {
    font-size: 2.5rem !important;
  }
  
  /* 图表高度增加 */
  .h-64 {
    height: 360px !important;
  }
  
  /* 表格优化 - 增大行高和字号 */
  table th,
  table td {
    padding: 14px 20px !important;
    font-size: 1.1rem !important;
  }
  
  /* 按钮增大 - 适合手指点击 */
  button,
  .silicone-btn {
    padding: 12px 28px !important;
    font-size: 1.1rem !important;
    border-radius: 12px !important;
  }
  
  /* 管理按钮卡片增大 */
  .mgmt-btn-card {
    padding: 24px !important;
    min-height: 140px !important;
    border-radius: 16px !important;
  }
  
  .mgmt-btn-card .icon {
    font-size: 3rem !important;
  }
  
  .mgmt-btn-card .label {
    font-size: 1.1rem !important;
  }
  
  /* 搜索框增大 */
  input[type="text"],
  input[type="date"],
  input[type="month"],
  select {
    padding: 14px 20px !important;
    font-size: 1.1rem !important;
    border-radius: 12px !important;
  }
  
  /* ✅ 修复：签名输入框不放大 - 使用更高优先级 */
  .signature-row input.signature-input,
  #printArea input.signature-input,
  input.signature-input[type="text"] {
    padding: 0 5px !important;
    font-size: 12px !important;
    height: 24px !important;
    line-height: 24px !important;
    box-sizing: border-box !important;
    min-height: auto !important;
    max-height: 24px !important;
  }
}

/* ============================================
   打印样式
   ============================================ */

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 3mm 3mm 3mm;
  }

  body {
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
    overflow: hidden !important;
  }
  
  /* 隐藏所有不必要的元素 */
  #loginBox,
  .no-print,
  #toast,
  .modal-overlay,
  #leavePanel,
  #mainBox>div:not(:last-child) {
    display: none !important;
  }

  /* 确保主容器和打印区域可见 */
  #mainBox,
  #printArea {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    background: white !important;
    overflow: visible !important;
  }

  #mainBox {
    padding: 0 !important;
    margin: 0 !important;
  }

  #printArea {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  /* 表格样式 - 高密度紧凑布局 */
  #printArea table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    page-break-inside: auto !important;
    page-break-after: avoid !important;
  }

  #printArea th,
  #printArea td {
    border: 1px solid #000 !important;
    font-size: 7px !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    padding: 1px 0 !important;
    line-height: 1 !important;
    height: auto !important;
  }
  
  /* 【重点】增大姓名和餐费列的字号 */
  #printArea .student-name-cell {
    font-size: 9px !important;
    font-weight: bold !important;
    padding: 1px 2px !important;
  }
  
  #printArea .meal-fee-cell {
    font-size: 12px !important;  /* 这里可以调整餐费字体大小 */
    font-weight: bold !important;
    padding: 1px 2px !important;
  }
  
  /* 标题样式 - 紧凑 */
  #printArea h2 {
    font-size: 16px !important;
    margin: 3px 0 5px 0 !important;
  }

  /* 打印时对号和叉号样式 */
  #printArea .check-mark {
    color: #00B42A !important;
    font-weight: bold !important;
    font-size: 12px !important;
  }

  #printArea .cross-mark {
    color: #F53F3F !important;
    font-weight: bold !important;
    font-size: 12px !important;
  }

  /* 打印时请假数字样式 */
  #printArea .leave-count {
    color: #F53F3F !important;
    font-weight: bold !important;
    font-size: 11px !important;
    background-color: #FFF1F0 !important;
    -webkit-print-color-adjust: exact !important;  /* Chrome/Safari */
    print-color-adjust: exact !important;           /* Firefox/标准 */
  }

  /* 斜杠表头样式 */
  #printArea th.corner-header {
    position: relative !important;
    padding: 0 !important;
    width: 50px !important;
    height: 28px !important;
    overflow: hidden !important;
  }

  #printArea th.corner-header::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -10%;
    width: 120%;
    height: 1px;
    background: #000;
    transform: rotate(-35deg);
    z-index: 0;
  }

  #printArea th.corner-header .corner-top {
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 9px;
    z-index: 1;
  }

  #printArea th.corner-header .corner-bottom {
    position: absolute;
    bottom: 3px;
    left: 6px;
    font-size: 9px;
    z-index: 1;
  }

  #printArea th:first-child,
  #printArea td:first-child {
    width: 50px !important;
  }

  #printArea th:last-child,
  #printArea td:last-child {
    width: 45px !important;
  }

  #printArea th:nth-last-child(2),
  #printArea td:nth-last-child(2) {
    width: 40px !important;
  }

  /* 签名行样式 - 紧凑 */
  #printArea .signature-row {
    margin-top: 1px !important;
    padding: 1px 0 !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
  }
  
  #printArea .signature-row>td {
    border: none !important;
    padding: 0 !important;
  }

  #printArea .signature-row table,
  #printArea .signature-row div {
    border: none !important;
  }

  .signature-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 12px !important;
    padding: 2px 5px !important;
  }

  /* 请假条网格样式 */
  .leave-ticket-grid {
    page-break-inside: avoid;
  }

  .leave-ticket-item {
    page-break-inside: avoid;
    border: 1px dashed #999 !important;
  }
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 9px;
}

th,
td {
  border: 1px solid #000;
  padding: 2px;
  text-align: center;
}

.check-green {
  color: #2ecc71;
  font-weight: bold;
}

/* 就餐对号样式 - 更大更醒目 */
.check-mark {
  color: #00B42A;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
}

/* 请假叉号样式 - 红色加粗 */
.cross-mark {
  color: #F53F3F;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
}

/* 请假数字样式 - 红色加粗醒目 */
.leave-count {
  color: #F53F3F;
  font-weight: bold;
  font-size: 13px;
  background-color: #FFF1F0;
}

/* 【新增】月统计表web端显示样式 - 固定列宽 */
.leave-header,
.meal-fee-header,
.leave-count,
.meal-fee-cell {
  width: 45px !important;
  min-width: 45px !important;
  max-width: 45px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* 表头字体 */
.leave-header,
.meal-fee-header {
  font-size: 10px !important;
  font-weight: bold !important;
  padding: 2px !important;
}

/* 数据单元格字体 */
.meal-fee-cell {
  font-size: 12px !important;
  font-weight: bold !important;
  padding: 2px !important;
}

.weekend {
  background-color: #f0f0f0;
}

/* 移动端触控优化 */
@media (max-width: 768px) {
  .silicone-btn {
    padding: 12px 20px;
    font-size: 15px;
    min-height: 44px;
    /* iOS推荐最小触控区域 */
  }

  .mgmt-btn-card {
    padding: 24px 18px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
    /* 防止iOS自动缩放 */
  }

  textarea {
    min-height: auto;
  }
}

/* ============================================
   移动端全面优化 - 响应式设计
   ============================================ */

/* 平板和手机端（小于1024px） */
@media (max-width: 1024px) {
  /* 统计卡片优化 */
  .grid.grid-cols-1.md\:grid-cols-3 > div {
    padding: 16px;
  }

  /* 图表高度调整 */
  #pieChart,
  #lineChart {
    height: 280px !important;
  }
}

/* ============================================
   移动端响应式设计
   ============================================ */

/* ========== 全面屏手机底部安全区域优化 ========== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  /* iPhone X及以上机型 */
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  /* 底部固定元素适配 */
  #leavePanel {
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }
  
  /* Toast提示适配 */
  #toast {
    top: calc(20px + env(safe-area-inset-top)) !important;
  }
}

/* ========== 全局滚动优化 - 确保所有设备都能正常滚动 ========== */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  -webkit-overflow-scrolling: touch;
  /* overscroll-behavior-y: contain; 防止橡皮筋效果 - 已注释，可能影响桌面滚动 */
}

/* 确保主容器可以正常滚动 */
#mainBox {
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
  overflow-y: auto !important; /* 明确允许垂直滚动 */
}

/* ============================================
   减少动画偏好适配
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* 手机端（小于768px） */
@media (max-width: 768px) {
  /* ========== 全局布局优化 ========== */
  body {
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    /* 防止移动端浏览器地址栏隐藏时的抖动 */
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }
  
  html {
    height: -webkit-fill-available;
  }

  #mainBox .max-w-7xl {
    padding: 8px;
  }

  /* ========== 沉浸式头部优化 ========== */
  #mainBox .bg-white.shadow-sm.sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: env(safe-area-inset-top);
    /* 防止微信浏览器中头部消失 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  #mainBox .bg-white.shadow-sm.sticky .max-w-7xl {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  #mainBox .bg-white.shadow-sm.sticky .text-lg {
    font-size: 16px;
    flex: 1;
  }

  #mainBox .bg-white.shadow-sm.sticky .flex.items-center.gap-3 {
    flex-wrap: wrap;
    justify-content: flex-end;
    width: 100%;
    gap: 6px;
  }

  #mainBox .bg-white.shadow-sm.sticky .flex.items-center.gap-3 span {
    font-size: 11px;
    padding: 4px 8px;
  }

  #mainBox .bg-white.shadow-sm.sticky .silicone-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* ========== 统计卡片优化 ========== */
  .grid.grid-cols-1.md\:grid-cols-3 {
    gap: 8px;
  }

  .grid.grid-cols-1.md\:grid-cols-3 > div {
    padding: 12px;
    border-left-width: 3px !important;
  }

  .grid.grid-cols-1.md\:grid-cols-3 > div .text-sm {
    font-size: 12px;
  }

  .grid.grid-cols-1.md\:grid-cols-3 > div .text-2xl {
    font-size: 20px;
  }

  /* ========== 管理按钮网格优化 - 关键优化 ========== */
  #mgmtBtnGrid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    padding: 0;
  }

  .mgmt-btn-card {
    padding: 16px 8px !important;
    border-radius: 12px !important;
  }

  .mgmt-btn-card .icon {
    font-size: 24px !important;
    margin-bottom: 6px !important;
  }

  .mgmt-btn-card .label {
    font-size: 11px !important;
    line-height: 1.3 !important;
  }

  /* ========== 图表区域优化 ========== */
  .grid.grid-cols-1.md\:grid-cols-2 {
    gap: 8px;
  }

  .grid.grid-cols-1.md\:grid-cols-2 > div {
    padding: 16px !important;
  }

  .grid.grid-cols-1.md\:grid-cols-2 > div h3 {
    font-size: 14px !important;
    margin-bottom: 12px !important;
  }

  /* ========== 实时就餐状态区域优化 - 容器占满整行 ========== */
  /* 实时就餐栏的整个容器宽度设置为100%，与上方大按钮一致 */
  .bg-white.rounded-xl.shadow-sm.p-6.fade-in:nth-of-type(3) {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* 实时就餐栏的表格容器宽度也设置为100% */
  #todayStatus {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
  }
  
  /* 实时就餐栏的输入框和按钮区域 */
  .bg-white.rounded-xl.shadow-sm.p-6.fade-in:nth-of-type(3) .flex.flex-wrap.gap-2.mb-4 {
    width: 100% !important;
  }
  
  /* 确保表格撑满容器 */
  #todayStatus table {
    width: 100% !important;
    min-width: 100% !important;
  }
  
  /* 月度统计与打印区域优化 - 保持2列布局 */
  .bg-white.rounded-xl.shadow-sm.p-6.fade-in:nth-of-type(4) .flex.flex-wrap.gap-2.mb-4 > * {
    flex: 1 1 calc(50% - 4px) !important;
  }
  
  .bg-white.rounded-xl.shadow-sm.p-6.fade-in:nth-of-type(4) .flex.flex-wrap.gap-2.mb-4 button {
    font-size: 14px !important;
    padding: 12px 8px !important;
  }

  /* ========== 防止微信/QQ浏览器中模态框穿透滚动 ========== */
  /* ✅ 修复：只在模态框打开时阻止背景滚动，不影响页面正常滚动 */
  .modal-overlay.active {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  
  /* ✅ 修复：移除错误的选择器，改为JavaScript动态控制 */
  /* 不再使用CSS控制body的滚动，避免影响正常页面滚动 */


  /* ========== 表格优化 - 确保撑满整行宽度 ========== */
  #todayStatus {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }
  
  #todayStatus table {
    width: 100% !important;
    display: table !important;
    table-layout: auto;
    min-width: 100% !important;
  }
  
  /* 表格单元格自适应宽度 */
  #todayStatus th,
  #todayStatus td {
    white-space: nowrap;
  }
  
  /* 操作列的按钮宽度自适应 */
  #todayStatus td:last-child {
    width: auto;
  }

  /* ========== 月度统计打印区域优化 ========== */
  #printArea {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    margin: 0;
    padding: 8px;
  }

  #printArea table {
    min-width: 100%;
    display: block;
  }

  /* ========== 浮动请假面板优化 ========== */
  #leavePanel {
    right: 10px !important;
    bottom: 10px !important;
  }

  #leavePanelIcon {
    width: 48px !important;
    height: 48px !important;
  }

  #leavePanelContent {
    width: calc(100vw - 20px) !important;
    max-width: 350px !important;
    right: 0 !important;
  }

  /* ========== 模态框优化 ========== */
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    max-height: 90vh !important;
    border-radius: 16px !important;
    margin: 10px !important;
  }

  .modal-header {
    padding: 16px 20px !important;
  }

  .modal-header h3 {
    font-size: 16px !important;
  }

  .modal-body {
    padding: 16px 20px !important;
    max-height: calc(90vh - 70px) !important;
  }

  /* ========== 模态框内表单优化 ========== */
  .modal-body .flex.flex-wrap.gap-3 {
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  .modal-body .flex.flex-wrap.gap-3 > * {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 0 !important;
  }

  .modal-body .flex.flex-wrap.gap-3 button {
    flex: 1 1 auto !important;
  }

  .modal-body input,
  .modal-body select,
  .modal-body textarea {
    width: 100% !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
  }

  /* 请假审批工具栏优化 */
  .modal-body .mb-4.p-3.bg-blue-50 {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .modal-body .mb-4.p-3.bg-blue-50 .flex.items-center.gap-3 {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .modal-body .mb-4.p-3.bg-blue-50 .flex.gap-2 {
    flex-wrap: wrap;
    gap: 6px !important;
  }

  .modal-body .mb-4.p-3.bg-blue-50 .flex.gap-2 button {
    flex: 1 1 calc(50% - 6px) !important;
    font-size: 11px !important;
    padding: 8px 6px !important;
    white-space: nowrap;
  }

  /* 安全审计标签页优化 */
  .flex.gap-2.mb-4.border-b {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px !important;
  }

  .flex.gap-2.mb-4.border-b button {
    flex-shrink: 0;
    font-size: 13px !important;
    padding: 10px 16px !important;
  }

  /* 请假详情弹窗优化 */
  #leaveDetailModal .modal-content {
    max-width: 95% !important;
  }

  /* 批量操作按钮优化 */
  .grid.grid-cols-2.gap-3 {
    gap: 8px !important;
  }

  .grid.grid-cols-2.gap-3 .mgmt-btn-card {
    padding: 12px 8px !important;
  }

  .grid.grid-cols-2.gap-3 .mgmt-btn-card .icon {
    font-size: 20px !important;
  }

  .grid.grid-cols-2.gap-3 .mgmt-btn-card .label {
    font-size: 11px !important;
  }

  /* 学生列表优化 */
  #stuList {
    max-height: 300px !important;
  }

  /* 教师列表优化 */
  #teacherList {
    max-height: 300px !important;
  }

  /* 节假日列表优化 */
  #holList {
    gap: 8px !important;
  }

  /* ========== 输入框优化 - 防止微信浏览器缩放 ========== */
  input,
  select,
  textarea {
    font-size: 16px !important; /* 关键：防止iOS自动缩放 */
    min-height: 44px;
    /* 微信浏览器中输入框焦点优化 */
    -webkit-tap-highlight-color: transparent;
  }
  
  /* 微信浏览器中textarea高度自适应 */
  textarea {
    min-height: auto;
    resize: vertical;
  }

  /* ========== 月统计表左右滑动优化 ========== */
  #printAreaContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    position: relative;
    /* 添加滚动指示器 */
    cursor: grab;
  }
  
  #printAreaContainer:active {
    cursor: grabbing;
  }
  
  #printAreaContainer::after {
    content: '← 左右滑动查看 →';
    position: absolute;
    right: 10px;
    bottom: 5px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 10px;
    z-index: 10;
  }
  
  #printAreaContainer:hover::after,
  #printAreaContainer:active::after {
    opacity: 1;
  }
  
  #printArea {
    min-width: max-content;
    display: block;
  }
  
  #printArea table {
    min-width: 100%;
    display: block;
  }
}

/* ============================================
   横屏沉浸式优化 - 防止地址栏和控制栏频繁出现
   ============================================ */

/* 横屏模式优化 - 移除max-width限制，适用于所有横屏设备 */
@media (orientation: landscape) {
  /* ✅ 修复：使用min-height而非固定height和position */
  html, body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    overflow-y: auto !important; /* 确保垂直滚动 */
    position: relative;
    width: 100%;
    height: auto !important; /* 修复：不要固定高度 */
    touch-action: auto !important; /* 允许所有滚动 */
    -webkit-touch-action: auto !important;
  }
  
  /* ✅ 修复：主容器允许内容自然撑开 */
  #mainBox {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    position: relative;
    height: auto !important;
    touch-action: auto !important;
  }
  
  /* 顶部导航栏固定 */
  #mainBox .bg-white.shadow-sm.sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* 内容区域适配 */
  #mainBox .max-w-7xl {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  
  /* 图表高度调整 */
  #pieChart,
  #lineChart {
    height: 200px !important;
  }
  
  /* 模态框高度限制 */
  .modal-content {
    max-height: 90vh !important;
  }
  
  .modal-body {
    max-height: calc(90vh - 70px) !important;
  }
  

  
  /* ✅ 横屏时所有元素允许单指滚动 */
  * {
    touch-action: auto !important;
    -webkit-touch-action: auto !important;
    -ms-touch-action: auto !important;
  }
}

/* 小屏手机（小于480px） */
@media (max-width: 480px) {
  /* 管理按钮网格 - 2列布局 */
  #mgmtBtnGrid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .mgmt-btn-card {
    padding: 12px 6px !important;
  }

  .mgmt-btn-card .icon {
    font-size: 20px !important;
  }

  .mgmt-btn-card .label {
    font-size: 10px !important;
  }

  /* 月度统计按钮 - 全宽显示 */
  .flex.flex-wrap.gap-2.mb-4 > * {
    flex: 1 1 100% !important;
  }

  .flex.flex-wrap.gap-2.mb-4 button {
    font-size: 14px !important;
    padding: 12px !important;
  }

  /* 模态框内表单 - 单列布局 */
  .modal-body .flex.flex-wrap.gap-3 > * {
    flex: 1 1 100% !important;
  }

  /* 请假审批工具栏按钮 - 全宽 */
  .modal-body .mb-4.p-3.bg-blue-50 .flex.gap-2 button {
    flex: 1 1 100% !important;
    font-size: 13px !important;
  }

  /* 图表高度进一步减小 */
  #pieChart,
  #lineChart {
    height: 240px !important;
  }

  /* 浮动请假面板内容 */
  #leavePanelContent {
    width: calc(100vw - 20px) !important;
  }
}

/* 超小屏（小于360px） */
@media (max-width: 360px) {
  .mgmt-btn-card .label {
    font-size: 9px !important;
  }

  .modal-header h3 {
    font-size: 14px !important;
  }

  .modal-body {
    padding: 12px 16px !important;
  }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-content {
    max-height: 95vh !important;
  }

  .modal-body {
    max-height: calc(95vh - 70px) !important;
  }

  #pieChart,
  #lineChart {
    height: 200px !important;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 硅胶拟态按钮风格 - Apple/Ant-Design优化 */
.silicone-btn {
  position: relative;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.05);
}

.silicone-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.1),
    0 2px 4px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.05);
}

.silicone-btn:active {
  transform: translateY(0);
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(0, 0, 0, 0.1),
    inset 0 -1px 2px rgba(255, 255, 255, 0.3);
}

.silicone-btn-blue {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.silicone-btn-green {
  background: linear-gradient(135deg, #34D399, #059669);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.silicone-btn-orange {
  background: linear-gradient(135deg, #FB923C, #EA580C);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.silicone-btn-purple {
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.silicone-btn-gray {
  background: linear-gradient(135deg, #9CA3AF, #6B7280);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.silicone-btn-red {
  background: linear-gradient(135deg, #F87171, #DC2626);
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 管理按钮卡片 - Apple/Ant-Design优化 */
.mgmt-btn-card {
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.mgmt-btn-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.1),
    0 4px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.mgmt-btn-card:active {
  transform: translateY(-1px);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.05),
    inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mgmt-btn-card .icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.mgmt-btn-card .label {
  font-size: 13px;
  font-weight: 600;
  color: #4E5969;
}

/* 弹窗样式 - Apple/Ant-Design优化 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #F5F7FA;
  border-radius: 20px;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  overflow: hidden;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: white;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 80px);
}

/* 弹窗内的硅胶输入框 */
.modal-body input,
.modal-body select {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  background: #ffffff;
  box-shadow:
    inset 2px 2px 4px #e0e0e0,
    inset -2px -2px 4px #ffffff;
  outline: none;
  transition: all 0.2s;
}

.modal-body input:focus,
.modal-body select:focus {
  box-shadow:
    inset 2px 2px 4px #e0e0e0,
    inset -2px -2px 4px #ffffff,
    0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 安全审计面板样式 */
.audit-panel {
  animation: fadeIn 0.3s;
}

.warning-item {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
  border-left: 4px solid #F53F3F;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.warning-item:hover {
  box-shadow: 0 2px 8px rgba(245, 63, 63, 0.2);
}

.warning-critical {
  background: linear-gradient(135deg, #fff0f0 0%, #ffcccc 100%);
  border-left-color: #DC2626;
}

.fingerprint-card {
  background: white;
  border: 1px solid #E5E6EB;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.fingerprint-card:hover {
  border-color: #165DFF;
  box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);
}

.fp-header {
  border-bottom: 2px solid #F2F3F5;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.fp-student {
  font-size: 16px;
  font-weight: 600;
  color: #1D2129;
}

.fp-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fp-row {
  display: flex;
  align-items: center;
  font-size: 13px;
}

.fp-label {
  min-width: 90px;
  color: #86909C;
  font-weight: 500;
}

.fp-value {
  flex: 1;
  color: #4E5969;
  word-break: break-all;
}

.fp-hash {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #165DFF;
  cursor: help;
}

.fingerprint-hash {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #86909C;
  word-break: break-all;
}

.device-info {
  font-size: 12px;
  color: #4E5969;
  margin-top: 4px;
}

.student-tag {
  display: inline-block;
  background: #E8F3FF;
  color: #165DFF;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  margin: 2px;
}

/* 【新增】通知弹窗动画 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in {
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====== 浮动窗口样式（教室管控专用） ====== */

.floating-window {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 900px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 100px);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  overflow: hidden;
}

.floating-window.minimized {
  width: 280px !important;
  height: 60px !important;
  max-height: 60px !important;
  overflow: hidden;
}

.floating-window.minimized .floating-window-body {
  display: none;
}

.floating-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: move;
  user-select: none;
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
}

.floating-window-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.floating-window-controls {
  display: flex;
  gap: 8px;
}

.floating-window-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.floating-window-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.floating-window-btn.close:hover {
  background: rgba(239, 68, 68, 0.8);
}

.floating-window-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: white;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .floating-window {
    width: calc(100vw - 20px) !important;
    right: 10px !important;
    left: 10px !important;
    top: 60px !important;
    max-height: calc(100vh - 70px);
  }
  
  .floating-window.minimized {
    width: 180px !important;
    height: 50px !important;
    max-height: 50px !important;
  }
}

/* 拖拽时的视觉反馈 */
.floating-window.dragging {
  opacity: 0.9;
  cursor: grabbing;
  box-shadow: 
    0 30px 80px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

/* 显示/隐藏动画 */
.floating-window.show {
  animation: floatIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-window.hide {
  animation: floatOut 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes floatOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

/* ============================================
   摄像头拍照弹窗样式优化
   ============================================ */
.camera-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh; /* 使用动态视口高度，适配移动端地址栏 */
  background: #000;
  display: flex;
  flex-direction: column;
  z-index: 99999;
}

.camera-video-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 默认竖屏填满屏幕 */
}

.camera-controls {
  position: absolute;
  bottom: 40px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 20px;
  z-index: 10000;
}

.camera-btn {
  padding: 14px 36px;
  font-size: 18px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.camera-btn-capture {
  background: rgba(16, 185, 129, 0.9);
}

.camera-btn-cancel {
  background: rgba(239, 68, 68, 0.9);
}

.camera-btn:active {
  transform: scale(0.95);
}

/* 横屏模式优化 */
@media (orientation: landscape) {
  .camera-video {
    object-fit: contain; /* 横屏时确保画面完整不被裁剪 */
    max-height: calc(100dvh - 100px); /* 预留按钮空间 */
  }

  .camera-controls {
    bottom: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    margin: 0 20px;
    width: auto;
    left: 50%;
    transform: translateX(-50%);
  }
}
