/* Tia Stay 管理系统 · 手帐风（与约课系统同一视觉语言） */
:root {
  --bg: #fbf8f2; --paper: #fffdf8; --ink: #3d3630; --muted: #8a7f72;
  --primary: #f6e1a3; --primary-dark: #e7c773; --accent: #a8c3a0;
  --danger: #d96c57; --ok: #7ba05b; --border: #e8dfcf;
  --shadow: 3px 3px 0 rgba(61,54,48,.14);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: #8a6d2f; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- 通用 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); border: 1.5px solid #d9b95c; color: var(--ink);
  padding: 10px 18px; border-radius: 999px; cursor: pointer; font-weight: 600;
  box-shadow: var(--shadow); text-decoration: none; min-height: 44px;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: var(--paper); border-color: var(--border); box-shadow: none; }
.btn.danger { background: #f6c8bc; border-color: var(--danger); }
.btn.ok { background: #cfe3c2; border-color: var(--ok); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; border-radius: var(--radius); }
.card {
  background: var(--paper); border: 1.5px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; background: #fff; min-height: 44px;
}
textarea { min-height: 70px; }
label.f { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
label.f > span { display: block; margin-bottom: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #f3ecdc; border: 1px solid var(--border); }
.tag.deep { background: #f6c8bc; border-color: var(--danger); }
.tag.done { background: #cfe3c2; }
.tag.doing { background: var(--primary); }
.tag.cancel { background: #e5e0d8; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
h2.ptitle { margin: 4px 0 14px; font-size: 20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: left; vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; }
.scroll-x { overflow-x: auto; }
.badge {
  display: inline-block; min-width: 18px; text-align: center; background: var(--danger);
  color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 5px; margin-left: 5px;
}

/* ---------- 登录 ---------- */
.login-wrap { max-width: 400px; margin: 8vh auto; padding: 0 16px; }
.login-card { background: var(--paper); border: 1.5px solid var(--border); border-radius: 20px; box-shadow: 5px 5px 0 rgba(61,54,48,.12); padding: 28px 24px; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tabs button { flex: 1; padding: 9px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; }
.tabs button.on { background: var(--primary); border-color: #d9b95c; font-weight: 700; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- 后台布局 ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex: none; background: var(--paper); border-right: 1.5px solid var(--border);
  padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { font-weight: 800; font-size: 17px; padding: 4px 10px 14px; }
.sidebar button.nav {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 15px; margin-bottom: 2px;
}
.sidebar button.nav.on { background: var(--primary); font-weight: 700; }
.sidebar .who { padding: 12px 10px; border-top: 1px dashed var(--border); margin-top: 12px; font-size: 13px; color: var(--muted); }
.main { flex: 1; padding: 20px; max-width: 1100px; margin: 0 auto; width: 100%; }
@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
  .sidebar .brand { width: 100%; }
  .sidebar button.nav { width: auto; }
  .sidebar .who { width: 100%; }
  .main { padding: 12px; }
}

/* ---------- 月历 ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-cell { background: var(--paper); border: 1.5px solid var(--border); border-radius: 10px; min-height: 92px; padding: 6px; font-size: 12px; }
.cal-cell.dim { opacity: .38; }
.cal-cell.today { border-color: #d9b95c; background: #fffbe9; }
.cal-cell .dnum { font-weight: 700; font-size: 13px; }
.cal-task { background: #fdf3d3; border: 1px solid #e8d48b; border-radius: 7px; padding: 2px 5px; margin-top: 4px; cursor: pointer; line-height: 1.35; }
.cal-task.done { background: #e2eed6; border-color: var(--accent); }
.cal-task.cancel { background: #eee; color: var(--muted); text-decoration: line-through; }
@media (max-width: 760px) { .cal-cell { min-height: 64px; font-size: 11px; } }

/* ---------- 员工端 ---------- */
.staff-shell { max-width: 560px; margin: 0 auto; padding: 14px 14px 90px; }
.staff-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px 12px; }
.staff-top .brand { font-weight: 800; font-size: 19px; }
.big-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.big-tabs button { flex: 1; padding: 13px 4px; font-size: 16px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--paper); cursor: pointer; font-weight: 600; }
.big-tabs button.on { background: var(--primary); border-color: #d9b95c; }
.task-card { background: var(--paper); border: 1.5px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; cursor: pointer; }
.task-card .prop { font-size: 19px; font-weight: 800; }
.task-card .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
.timer-box { text-align: center; padding: 10px 0; }
.timer-num { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.photo-grid img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1.5px solid var(--border); }
.photo-add {
  width: 84px; height: 84px; border-radius: 10px; border: 2px dashed #d9b95c; background: #fffbe9;
  display: flex; align-items: center; justify-content: center; font-size: 26px; cursor: pointer; color: #8a6d2f;
}
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1.5px solid var(--border);
  display: flex; z-index: 40;
}
.bottom-nav button { flex: 1; padding: 12px 4px calc(12px + env(safe-area-inset-bottom)); background: none; border: none; font-size: 15px; font-weight: 600; cursor: pointer; }
.bottom-nav button.on { color: #8a6d2f; background: #fdf6dd; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(61,54,48,.45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--paper); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 20px; animation: up .18s ease;
}
@media (min-width: 700px) { .modal-mask { align-items: center; } .modal { border-radius: 20px; } }
@keyframes up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 10px; font-size: 18px; }
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.kv b { font-weight: 700; }
.checkline { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 15px; }
.checkline input { width: 22px; height: 22px; }
.invoice-paper { background: #fff; border: 1.5px solid var(--border); border-radius: 8px; padding: 26px; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}
