/* 值日排班系统 · 样式（手机优先） */
:root {
  --bg: #eef2f9;
  --card: #ffffff;
  --ink: #16203a;
  --muted: #6b7686;
  --line: #dfe5ef;
  --accent: #2f6fed;
  --accent-dark: #1b4fc4;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22, 32, 58, .07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  padding-bottom: 40px;
}

/* ---------- 顶栏 / 标签页 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #2f6fed, #1b4fc4);
  color: #fff;
  box-shadow: 0 2px 12px rgba(27, 79, 196, .25);
}
.topbar .cls { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.topbar .sub { font-size: 12px; opacity: .88; margin-top: 2px; }

.tabs {
  position: sticky; top: 56px; z-index: 19;
  display: flex; background: var(--card); border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs .tab {
  flex: 1 0 auto; min-width: 84px;
  padding: 11px 8px; border: 0; background: none; cursor: pointer;
  font-size: 14px; color: var(--muted); font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

main { padding: 14px; max-width: 900px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb8 { margin-bottom: 8px; }

/* ---------- 今日大卡片 ---------- */
.hero {
  border-radius: 18px; padding: 18px; color: #fff; margin-bottom: 12px;
  background: linear-gradient(135deg, #2f6fed, #17398f);
  box-shadow: 0 6px 22px rgba(27, 79, 196, .3);
}
.hero.rest { background: linear-gradient(135deg, #64748b, #3d4a61); box-shadow: 0 6px 22px rgba(61, 74, 97, .28); }
.hero .hd { font-size: 13px; opacity: .9; display: flex; justify-content: space-between; align-items: center; }
.hero .gd { font-size: 40px; font-weight: 800; letter-spacing: 1px; margin: 6px 0 2px; line-height: 1.1; }
.hero .gd small { font-size: 16px; font-weight: 600; opacity: .9; }
.hero .meta { font-size: 14px; opacity: .96; }
.hero .cd {
  margin-top: 12px; display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); font-size: 13px; font-weight: 600;
}
.hero .note { margin-top: 10px; font-size: 12px; opacity: .85; }
.hero .chips { margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: #eef3ff; color: var(--accent-dark);
  border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600;
}
.hero .chip { background: rgba(255, 255, 255, .2); color: #fff; }

/* ---------- 按钮 ---------- */
button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
button.btn.ghost, a.btn.ghost { background: #fff; color: var(--accent); }
.topbar button.btn.ghost { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .5); }
button.btn.mini { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
button.btn.warn { background: #fff; color: var(--warn); border-color: #f0c98a; }
button.btn.danger { background: #fff; color: var(--danger); border-color: #f3b4b4; }

/* ---------- 列表行 ---------- */
.list { border-top: 1px solid var(--line); }
.list .li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.list .li:last-child { border-bottom: 0; }
.list .li .d { font-weight: 600; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #eef3ff; color: var(--accent-dark);
}
.badge.holiday { background: #fdecec; color: var(--danger); }
.badge.makeup { background: #fff4e5; color: var(--warn); }
.badge.rest { background: #eef1f5; color: var(--muted); }
.badge.today { background: var(--ok); color: #fff; }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 17px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .wk { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 4px 0; }
.cell {
  min-height: 56px; border-radius: 10px; background: #f7f9fd; border: 1px solid transparent;
  padding: 4px; cursor: pointer; position: relative;
}
.cell.blank { background: none; cursor: default; }
.cell .n { font-size: 13px; font-weight: 700; }
.cell .g { font-size: 11px; font-weight: 700; color: var(--accent-dark); }
.cell.clean { background: #e9f0ff; }
.cell.holiday { background: #fdeeee; }
.cell.holiday .g { color: var(--danger); }
.cell.makeup { background: #fff5e8; }
.cell.makeup .g { color: var(--warn); }
.cell.out { opacity: .35; }
.cell.today { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(22, 163, 74, .18) inset; }
.cell.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 111, 237, .2) inset; }
.cell .dot { position: absolute; right: 5px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.tbl th { background: #f4f7fd; font-weight: 700; position: sticky; top: 0; z-index: 1; }
table.tbl td.names { white-space: normal; min-width: 150px; }
table.tbl tr.today td { background: #eefaf1; font-weight: 700; }
table.tbl tr.holiday td { background: #fdf3f3; color: var(--danger); }

/* ---------- 表单 ---------- */
label.fld { display: block; margin-bottom: 10px; }
label.fld span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=date], input[type=time], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.two { display: flex; gap: 10px; }
.two > * { flex: 1; }
.pin-box { max-width: 320px; margin: 40px auto; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(16, 22, 38, .5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 86vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-head button { border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.modal-body { padding: 14px; overflow: auto; }
.copy-area { width: 100%; min-height: 150px; font-size: 14px; line-height: 1.7; }

.tip { background: #fff9e8; border: 1px solid #f2dfae; color: #8a5a00; border-radius: 10px; padding: 10px; font-size: 13px; }

/* ---------- 留证（照片） ---------- */
.hidden { display: none !important; }
.err { color: var(--danger); }
input[type="date"] {
  font: inherit; font-size: 14px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--text);
}
.btn.big { width: 100%; padding: 16px 18px; font-size: 17px; border-radius: 14px; }
.btn.on { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }
.chip.room {
  font-size: 14px; padding: 9px 13px; border: 1px solid var(--line); background: #fff;
  color: var(--text); cursor: pointer; border-radius: 999px; font-weight: 600;
}
.chip.room.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.wall .ph {
  margin: 0; background: #f3f5f9; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
}
.wall .ph img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; }
.wall .ph .noimg { height: 150px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.wall .ph figcaption { padding: 6px 8px; font-size: 12px; line-height: 1.5; }
.wall .ph .btn.mini { margin-top: 4px; }

.lightbox {
  position: fixed; inset: 0; background: rgba(8, 12, 20, .9); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

@media (max-width: 420px) {
  .hero .gd { font-size: 34px; }
  main { padding: 10px; }
  .wall { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 打印：只印当前页，去掉按钮 ---------- */
@media print {
  .topbar, .tabs, .no-print, .toolbar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .view { display: none; }
  .view.active { display: block; }
}
