/* ==================== 锦创服务 - 主样式 ==================== */
:root {
  --bg: #f0f2f5;
  --card-bg: #fff;
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --danger: #d93025;
  --success: #188038;
  --warning: #e37400;
  --border: #e0e0e0;
  --text: #333;
  --text2: #666;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .08);
  --sidebar-w: 240px;
  --header-h: 56px;
  --content-max: 1400px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ---- 登录页 ---- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo { max-width: 280px; max-height: 120px; border-radius: 12px; object-fit: contain; }
.login-brand-text { font-size: 34px; font-weight: 800; color: var(--primary); letter-spacing: 2px; }
.login-card .wechat-btn { width: 100%; padding: 12px; background: #07c160; color: #fff; border: none; border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-card .wechat-btn:hover { background: #06ad56; }
.login-card .divider { text-align: center; color: #999; font-size: 12px; margin-bottom: 16px; }
.login-card label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #555; }
.login-card input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; margin-bottom: 16px; outline: none; }
.login-card input:focus { border-color: var(--primary); }
.login-card .local-btn { width: 100%; padding: 13px; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 16px; font-weight: 600; cursor: pointer; }
.login-card .local-btn:hover { background: var(--primary-dark); }
.login-card .tips { text-align: center; color: #999; font-size: 12px; margin-top: 16px; }

/* ---- 主布局 ---- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: #fff; box-shadow: 2px 0 8px rgba(0, 0, 0, .06); position: fixed; left: 0; top: 0; bottom: 0; z-index: 300; display: flex; flex-direction: column; transition: transform .25s ease; }
.sidebar .logo { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar .logo .sidebar-logo { max-height: 34px; max-width: 150px; object-fit: contain; }
.sidebar .logo span { font-size: 20px; font-weight: 700; color: var(--primary); }
.sidebar .nav-list { flex: 1; padding: 8px 0; overflow-y: auto; }
.sidebar .nav-item { padding: 14px 20px; font-size: 14px; color: var(--text2); cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 10px; }
.sidebar .nav-item:hover { background: #f5f5f5; color: var(--primary); }
.sidebar .nav-item.active { background: #e8f0fe; color: var(--primary); font-weight: 600; }
.sidebar .nav-item .badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e8f0fe; color: var(--primary); }
.sidebar .user-section { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar .user-section .user-name { font-size: 14px; font-weight: 600; }
.sidebar .user-section .user-role { font-size: 12px; color: var(--text2); margin-top: 4px; }
.sidebar .logout-btn { padding: 8px 12px; font-size: 13px; color: var(--danger); cursor: pointer; margin-top: 8px; }
.sidebar .pwd-btn { padding: 8px 12px; font-size: 13px; color: var(--primary); cursor: pointer; margin-top: 8px; }

/* 遮罩层（移动端抽屉打开时） */
.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 250; }

.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; min-width: 0; }
.main-header { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); padding: 0 24px; display: flex; align-items: center; gap: 12px; height: var(--header-h); position: sticky; top: 0; z-index: 50; }
.main-header .page-title { font-size: 18px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; border: none; background: none; font-size: 22px; cursor: pointer; padding: 8px; margin-left: -8px; color: var(--text); line-height: 1; }
.main-content .page-body { padding: 20px 24px; max-width: var(--content-max); margin: 0 auto; }

/* ---- 首页品牌区 ---- */
.home-hero { display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 22px 26px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.home-hero-logo { max-width: 320px; max-height: 120px; object-fit: contain; }
@media (max-width: 560px) { .home-hero-logo { max-width: 100%; } }

/* ---- 通用组件 ---- */
.btn { padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 13px; transition: all .2s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: #f5f5f5; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card h2 { font-size: 16px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; }
.toolbar input { min-width: 200px; flex: 1 1 200px; max-width: 100%; }
.table-wrap { overflow-x: auto; max-height: 65vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { background: #f8f9fa; padding: 10px 8px; text-align: center; font-weight: 600; border-bottom: 2px solid #dee2e6; position: sticky; top: 0; white-space: nowrap; z-index: 1; }
table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid #eee; white-space: nowrap; }
table tr:hover { background: #f5f8ff; }

/* ---- 页签（模块内导航） ---- */
.tabs { display: flex; gap: 0; background: #fff; border-bottom: 1px solid var(--border); padding: 0; overflow-x: auto; margin-bottom: 20px; border-radius: var(--radius) var(--radius) 0 0; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab { padding: 14px 20px; cursor: pointer; font-size: 14px; white-space: nowrap; color: var(--text2); border-bottom: 2px solid transparent; flex-shrink: 0; }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 400; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); -webkit-overflow-scrolling: touch; }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal input, .modal select, .modal textarea { font-size: 16px; }
.modal .btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; top: 20px; right: 20px; left: auto; max-width: calc(100vw - 40px); z-index: 999; padding: 12px 20px; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600; display: none; animation: fadeIn .3s; }
.toast.show { display: block; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- 沙盘专用 ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; text-align: center; }
.kpi-card .num { font-size: 28px; font-weight: 700; }
.kpi-card .label { font-size: 13px; color: var(--text2); margin-top: 4px; }
.kpi-card.blue .num { color: var(--primary); }
.kpi-card.green .num { color: var(--success); }
.kpi-card.orange .num { color: var(--warning); }
.kpi-card.red .num { color: var(--danger); }
.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.chart-grid .card canvas { max-height: 350px; }
.import-section textarea { width: 100%; height: 150px; border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-family: monospace; font-size: 16px; resize: vertical; outline: none; }
.import-section .hint { font-size: 12px; color: #999; margin-top: 6px; }
table td.editable { cursor: pointer; background: #fffde7; }
table td.editable:hover { background: #fff9c4; }
table td.readonly { color: #888; font-size: 12px; }
.col-manual { background: #e8f5e9 !important; cursor: pointer; }
.dropdown-select { width: 50px; padding: 4px; border: 1px solid #ccc; border-radius: 4px; text-align: center; }
.badge-s { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #fce8e6; color: #c5221f; }
.badge-a { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e6f4ea; color: #1e8e3e; }
.badge-b { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e8f0fe; color: #1967d2; }

/* ---- 校园网预约专用 ---- */
.order-form { max-width: 500px; margin: 0 auto; }
.order-form .form-group { margin-bottom: 16px; }
.order-form .form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.order-form .form-group input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; }
.order-form .form-group input:focus { border-color: var(--primary); outline: none; }
.order-product { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 12px; padding: 24px; color: #fff; margin-bottom: 24px; }
.order-product .title { font-size: 20px; font-weight: 700; }
.order-product .desc { font-size: 14px; margin-top: 8px; }
.order-product .price { font-size: 32px; font-weight: 700; margin-top: 12px; }
.order-product .price-note { font-size: 12px; opacity: .8; }
.pay-section { background: #fff; border-radius: 12px; padding: 24px; text-align: center; }
.pay-section .pay-amount { font-size: 36px; font-weight: 700; color: var(--danger); margin: 16px 0; }
.pay-section .pay-amount .unit { font-size: 18px; }
.pay-section .pay-tip { font-size: 14px; color: var(--text2); margin-bottom: 16px; }
.pay-section .wechat-pay-btn { padding: 14px 32px; background: #07c160; color: #fff; border: none; border-radius: 8px; font-size: 18px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.pay-section .wechat-pay-btn:hover { background: #06ad56; }
.pay-section .manual-pay-info { margin-top: 20px; padding: 16px; background: #f8f9fa; border-radius: 8px; font-size: 13px; color: var(--text2); }
.qrcode-management { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.qrcode-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.qrcode-card .qr-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.qrcode-card canvas { margin: 0 auto 12px; max-width: 100%; }
.qrcode-card .qr-stats { font-size: 12px; color: var(--text2); }

/* ---- 状态标签 ---- */
.status-tag { padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-unpaid { background: #feeae6; color: #d93025; }
.status-paid { background: #e6f4ea; color: #188038; }
.status-pending { background: #fef7e0; color: #e37400; }
.status-verified { background: #e6f4ea; color: #188038; }
.status-rejected { background: #feeae6; color: #d93025; }
.status-processing { background: #e8f0fe; color: #1967d2; }
.status-completed { background: #e6f4ea; color: #188038; }

/* ==================== 响应式 ==================== */

/* 中屏：图表单列 */
@media (max-width: 1200px) {
  .chart-grid { grid-template-columns: 1fr; }
}

/* 移动端：抽屉式侧边栏 + 全宽内容 */
@media (max-width: 768px) {
  /* 侧边栏默认收起，加 .open 弹出 */
  .sidebar { transform: translateX(-100%); width: min(78vw, 280px); box-shadow: 4px 0 24px rgba(0, 0, 0, .18); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.show { display: block; }
  .sidebar .nav-item { padding: 16px 20px; font-size: 15px; }

  .main-content { margin-left: 0; }
  .menu-btn { display: block; }
  .main-header { padding: 0 14px; }
  .main-header .page-title { font-size: 16px; }
  .main-content .page-body { padding: 12px; }

  /* 卡片与组件更紧凑 */
  .card { padding: 14px; margin-bottom: 14px; border-radius: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 14px 8px; }
  .kpi-card .num { font-size: 22px; }
  .kpi-card .label { font-size: 12px; }

  /* 触控友好 */
  .btn { padding: 10px 14px; font-size: 14px; min-height: 40px; }
  .btn-sm { padding: 7px 10px; font-size: 13px; min-height: 34px; }
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { padding: 10px 12px; font-size: 16px; }
  .toolbar input { min-width: 0; flex: 1 1 100%; }
  .tabs .tab { padding: 13px 14px; font-size: 14px; }

  /* 表格：略小字号 + 惯性滚动（横向滑动查看） */
  table { font-size: 12px; }
  table th { padding: 9px 6px; }
  table td { padding: 8px 5px; }
  .table-wrap { max-height: 70vh; border-radius: 6px; }

  /* 弹窗全宽贴底更好操作 */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal .btn-row .btn { flex: 1; justify-content: center; }

  .toast { top: 12px; left: 12px; right: 12px; text-align: center; }
  .login-card { padding: 28px 20px; }
  .chart-grid .card canvas { max-height: 260px; }
  .qrcode-management { grid-template-columns: 1fr; }
}

/* 超小屏微调 */
@media (max-width: 380px) {
  .kpi-card .num { font-size: 19px; }
  .main-header .page-title { font-size: 15px; }
}

/* ---- 床位卡片与批注 ---- */
.bed-card { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.bed-card-header { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bed-card-title { font-weight: 600; min-width: 70px; color: var(--text); }
.bed-check { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.bed-check input { cursor: inherit; }
.bed-notes { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.bed-note-item { padding: 8px 10px; background: #f8f9fa; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.bed-note-item:last-child { margin-bottom: 0; }
.bed-note-meta { color: var(--text2); font-size: 12px; margin-bottom: 4px; }
.bed-note-text { color: var(--text); line-height: 1.5; word-break: break-all; }
.bed-note-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bed-note-edit input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.bed-note-add { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.bed-note-add input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 4px; }
