* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f1f5f9; color: #0f172a; font-size: 15px;
}
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* 通用组件 */
.btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; cursor: pointer;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-success { background: #15803d; color: #fff; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-warn { background: #d97706; color: #fff; }
.btn-ghost { background: #e2e8f0; color: #334155; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.input {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 12px 14px;
  font-size: 15px; background: #fff; outline: none;
}
.input:focus { border-color: #1d4ed8; }
.field-label { display: block; font-size: 13px; color: #64748b; margin: 14px 0 6px; }
.card { background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(15,23,42,.06); }

/* 登录页 */
#view-login { display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg,#1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%); min-height: 100vh; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.login-logo { text-align: center; color: #fff; margin-bottom: 26px; }
.login-logo-icon {
  width: 64px; height: 64px; border-radius: 18px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; margin: 0 auto 12px;
  border: 1px solid rgba(255,255,255,.3);
}
.login-logo h1 { font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.login-card { background: #fff; border-radius: 18px; padding: 24px 22px 28px; box-shadow: 0 18px 40px rgba(2,20,60,.35); }
.login-card h2 { font-size: 18px; text-align: center; }
.login-sub { text-align: center; color: #94a3b8; font-size: 13px; margin: 6px 0 4px; }
.login-msg { color: #b91c1c; font-size: 13px; margin-top: 12px; text-align: center; min-height: 18px; }
.login-foot { text-align: center; color: rgba(255,255,255,.75); font-size: 12px; margin-top: 22px; }

/* 主界面 */
#view-main { min-height: 100vh; padding-bottom: 64px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: #1d4ed8; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-user { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 8px; }
.topbar-user .role-tag { background: rgba(255,255,255,.2); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.content { max-width: 860px; margin: 0 auto; padding: 14px 12px 20px; }

/* 底部导航 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid #e2e8f0;
  display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; text-align: center; padding: 8px 0 6px; font-size: 11px; color: #64748b; cursor: pointer;
}
.nav-item .nav-ico { display: block; font-size: 20px; line-height: 1.2; }
.nav-item.active { color: #1d4ed8; font-weight: 600; }

/* 列表 */
.seg { display: flex; background: #e2e8f0; border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg-item { flex: 1; text-align: center; padding: 8px 0; font-size: 14px; border-radius: 8px; color: #475569; cursor: pointer; }
.seg-item.active { background: #fff; color: #1d4ed8; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.list-item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 0; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; line-height: 1.4; }
.card-meta { font-size: 12px; color: #94a3b8; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.badge { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.badge-published { background: #dcfce7; color: #15803d; }
.badge-pending_director { background: #fef9c3; color: #a16207; }
.badge-pending_admin { background: #fef9c3; color: #a16207; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }
.card-summary { font-size: 14px; color: #475569; margin-top: 6px; white-space: pre-wrap; line-height: 1.6; }
.card-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* 详情 */
.detail-title { font-size: 20px; font-weight: 700; line-height: 1.4; }
.detail-meta { font-size: 13px; color: #94a3b8; margin: 10px 0 14px; }
.detail-content { white-space: pre-wrap; line-height: 1.8; color: #1e293b; font-size: 15px; }
.approve-box { margin-top: 16px; }
.approve-note { font-size: 13px; color: #b91c1c; background: #fee2e2; border-radius: 8px; padding: 8px 12px; margin-top: 10px; }

/* 排班网格 */
.sched-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.sched-table th, .sched-table td { border: 1px solid #e2e8f0; padding: 6px 4px; text-align: center; font-size: 12px; vertical-align: top; }
.sched-table th { background: #f8fafc; color: #334155; font-weight: 600; }
.sched-table .shift-cell { background: #f0f9ff; font-weight: 600; color: #0369a1; white-space: nowrap; }
.sched-table .station-cell { background: #f8fafc; color: #64748b; font-size: 11px; white-space: nowrap; }
.staff-chips { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.chip { background: #dbeafe; color: #1e40af; border-radius: 6px; padding: 1px 6px; font-size: 11px; white-space: nowrap; }
.chip-editable { cursor: pointer; }
.chip-empty { color: #cbd5e1; }
.week-label { font-size: 13px; font-weight: 600; color: #334155; margin: 14px 0 6px; }

/* 统计 */
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table th, .stats-table td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: center; font-size: 13px; }
.stats-table th { background: #f8fafc; }

/* 弹出面板 */
.sheet-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: #fff;
  border-radius: 18px 18px 0 0; max-height: 78vh; display: flex; flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0,0,0,.2);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #e2e8f0; }
.sheet-head span { font-weight: 600; font-size: 16px; }
.sheet-body { padding: 12px 16px 20px; overflow-y: auto; }
.check-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 2px; border-bottom: 1px solid #f1f5f9; font-size: 15px; }
.check-item input { width: 20px; height: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%,-50%); z-index: 99;
  background: rgba(15,23,42,.88); color: #fff; border-radius: 10px; padding: 12px 20px;
  font-size: 14px; max-width: 80%; text-align: center;
}

/* 表单页 */
.form-item { margin-bottom: 14px; }
textarea.input { resize: vertical; min-height: 120px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-head h3 { font-size: 17px; }
.empty-tip { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 14px; }
.picker-row { display: flex; gap: 10px; }
.month-select { padding: 8px 12px; border-radius: 8px; border: 1px solid #cbd5e1; font-size: 14px; background: #fff; }

/* 排班页 今日/明日值班提醒 */
.duty-card { font-size: 14px; }
.duty-card h4 { font-size: 15px; }
.duty-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed #e2e8f0; }
.duty-row:last-of-type { border-bottom: none; }
.duty-label { color: #334155; font-weight: 600; white-space: nowrap; }
.duty-status { text-align: right; }
.duty-status-line { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2e8f0; color: #94a3b8; font-size: 13px; }
.duty-yes { color: #16a34a; font-weight: 700; }
.duty-no { color: #94a3b8; }
.duty-today { margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; font-size: 12px; color: #64748b; line-height: 1.7; }

/* 排班月视图（整月一览） */
.month-shift-title { font-weight: 600; font-size: 14px; color: #0f172a; margin: 14px 0 6px; }
.month-shift-title:first-child { margin-top: 0; }
.month-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.month-table th { background: #f1f5f9; color: #334155; padding: 6px 4px; border: 1px solid #e2e8f0; white-space: nowrap; font-weight: 600; }
.month-table td { border: 1px solid #e2e8f0; padding: 6px 4px; text-align: center; color: #334155; line-height: 1.5; }
.month-table td.mt-date { background: #fafbfc; color: #64748b; white-space: nowrap; font-weight: 600; }

/* 排班日视图（单日明细） */
.day-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.day-table th { background: #2563eb; color: #fff; padding: 9px 8px; border: 1px solid #2563eb; font-weight: 600; }
.day-table td { border: 1px solid #e2e8f0; padding: 9px 8px; color: #334155; line-height: 1.5; }
.day-table td.dt-shift { font-weight: 600; text-align: center; white-space: nowrap; }

/* 桌面适配 */
@media (min-width: 900px) {
  body { font-size: 15px; }
  .bottom-nav { max-width: 520px; left: 50%; transform: translateX(-50%); border-radius: 14px 14px 0 0; }
  .content { padding: 20px; }
}
