:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2129; --muted: #86909c; --line: #e5e6eb;
  --primary: #1f6feb; --primary-soft: #e8f0fe; --ok: #16a34a; --warn: #d97706; --err: #dc2626;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
button, input, textarea, select { font: inherit; }
.hidden { display: none !important; }

header.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
header.top .in { max-width: 1200px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 16px; }
header.top .brand { font-weight: 600; font-size: 17px; color: var(--text); }
header.top .sp { flex: 1; }
header.top .user { color: var(--muted); font-size: 14px; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c9cdd4; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=password], textarea, select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.muted { color: var(--muted); }
.err-msg { color: var(--err); font-size: 14px; min-height: 1.6em; }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-wrap .card { width: 100%; max-width: 380px; padding: 32px; }
.login-wrap h1 { text-align: center; margin-bottom: 24px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
/* 后台 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 16px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row .sp { flex: 1; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { border: 0; }
.side-list { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 800px) { .side-list { grid-template-columns: 1fr; } }
.side-list .items button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.side-list .items button.on { background: var(--primary-soft); color: var(--primary); }
.upload-progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.upload-progress > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.chk-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.chk-list label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.cell-done { color: var(--ok); font-weight: 600; }
.cell-part { color: var(--warn); }
.cell-none { color: #c9cdd4; }

dialog { border: 0; border-radius: 12px; padding: 24px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin-bottom: 16px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); background: #1d2129; color: #fff; padding: 10px 20px; border-radius: 8px; z-index: 1000; font-size: 14px; }

/* ===== 管理系统 ===== */
input[type=number], input[type=date], input[type=month] { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none; }
input[type=number]:focus, input[type=date]:focus, input[type=month]:focus, select:focus { border-color: var(--primary); }
header.top .nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
header.top .nav a { color: #4e5969; padding: 6px 10px; border-radius: 8px; white-space: nowrap; position: relative; }
header.top .nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
header.top .nav a .badge { position: absolute; top: -2px; right: -4px; }
.badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; text-align: center; font-weight: 600; }
@media (max-width: 700px) { header.top .nav { order: 10; width: 100%; } }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: inherit; display: block; }
a.stat:hover { border-color: var(--primary); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted); font-size: 12px; }
.stat.alert .v { color: var(--err); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.inc { color: var(--ok); }
.exp { color: var(--err); }
.section { margin-bottom: 24px; }
.section > h2 { display: flex; align-items: center; gap: 8px; }
.list-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.list-card .t { font-weight: 600; font-size: 16px; }
.list-card .m { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list-card .d { margin-top: 8px; white-space: pre-wrap; font-size: 14px; }
.list-card .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }
.img-view { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 2000; display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.img-view img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.att-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; margin: 4px 0 8px; }
.att-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.att-row .n { flex: 1; min-width: 0; }
.att-row .n small { color: var(--muted); margin-left: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.seg button { border: 0; background: #fff; padding: 4px 10px; cursor: pointer; font-size: 13px; color: #4e5969; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on[data-v=present] { background: #dcfce7; color: var(--ok); font-weight: 600; }
.seg button.on[data-v=leave] { background: #fef3c7; color: var(--warn); font-weight: 600; }
.seg button.on[data-v=absent] { background: #fee2e2; color: var(--err); font-weight: 600; }
.period { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.period select, .period input { width: auto; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 80px; }
.progress > i { display: block; height: 100%; background: var(--primary); }
.progress.done > i { background: var(--ok); }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); }
.chk-pick { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 12px; }
.chk-pick label { display: flex; gap: 6px; align-items: center; cursor: pointer; font-size: 14px; }
.sub-row td { background: #fafbfc; font-size: 13px; color: #4e5969; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f7f9fc; }
.tag { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 10px; line-height: 20px; white-space: nowrap; background: #f2f3f5; color: #4e5969; }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.warn { background: #fef3c7; color: var(--warn); }
.tag.err { background: #fee2e2; color: var(--err); }
.tag.info { background: var(--primary-soft); color: var(--primary); }
@media (max-width: 700px) {
  header.top .in { height: auto; min-height: 50px; flex-wrap: wrap; gap: 6px 10px; padding-top: 8px; padding-bottom: 6px; }
  header.top .brand { font-size: 15px; }
  header.top .user { display: none; }
  header.top .nav { order: 10; width: 100%; margin: 0 -6px; }
  main { padding-top: 16px; }
  h1 { font-size: 20px; }
}
