/* 外壳按家庭事务系统那一套：导航栏 220px、页眉 60px、四色统计卡、白卡片、居中页脚。
   字体按「系统字体」规则：苹方 / 微软雅黑 / 思源黑体。 */

:root {
  --font: "PingFang SC", "Microsoft YaHei", "微软雅黑", "Source Han Sans SC", "Noto Sans SC", "思源黑体", sans-serif;
  --blue: #1E5BB8;
  --blue-soft: #eff6ff;
  --text: #1a1a2e;
  --muted: #8b8fa3;
  --line: #e8e8ef;
  --bg: #f4f6fa;
  --red: #ff4d4f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 导航栏 ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 220px; z-index: 50;
  background: linear-gradient(180deg, #0d3a7a 0%, #1E5BB8 100%);
  color: #fff; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-logo { height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 18px; }
.sidebar-logo .mark, .page-title .mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
}
.sidebar-logo .mark { background: rgba(255, 255, 255, .16); color: #fff; }
.sidebar-logo .mark svg { width: 18px; height: 18px; }
.sidebar-logo .title { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.nav-group { padding: 8px 10px 20px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 40px; padding: 0 12px; margin: 2px 0; border: 0; border-radius: 8px;
  background: transparent; color: rgba(255, 255, 255, .7);
  font-size: 13px; font-weight: 400; text-align: left;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, #1E5BB8, #5aa2f0); }
.nav-block > .nav-item.active { background: rgba(255, 255, 255, .1); }
.nav-item .icon { width: 18px; display: grid; place-items: center; flex: none; }
.nav-item .icon svg { width: 15px; height: 15px; }
.nav-item .chev {
  margin-left: auto; width: 6px; height: 6px; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .15s;
}
.nav-block.open > .nav-item .chev { transform: rotate(-135deg); }
.nav-sub { display: none; }
.nav-block.open > .nav-sub { display: block; }
.nav-sub a {
  display: block; height: 36px; line-height: 36px; padding: 0 12px 0 40px; margin: 2px 0;
  border-radius: 8px; color: rgba(255, 255, 255, .7); font-size: 13px; font-weight: 400;
}
.nav-sub a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-sub a.active { color: #fff; background: linear-gradient(90deg, #1E5BB8, #5aa2f0); }
.sidebar-mask { display: none; }

/* ---------- 页眉 ---------- */
.main { margin-left: 220px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 60px; padding: 0 24px;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.page-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--text); }
.page-title .mark { background: linear-gradient(180deg, #0d3a7a, #1E5BB8); color: #fff; }
.page-title .mark svg { width: 17px; height: 17px; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-toggle {
  display: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; place-items: center; color: var(--text);
}
.nav-toggle svg { width: 18px; height: 18px; }
.me-menu { position: relative; }
.me-menu summary { list-style: none; }
.me-menu summary::-webkit-details-marker { display: none; }
.me-btn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: 18px; cursor: pointer; }
.me-btn:hover { background: #f4f6fa; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--blue); color: #fff; font-size: 13px; font-weight: 600;
}
.who { font-size: 13px; font-weight: 500; }
.me-panel {
  position: absolute; right: 0; top: 42px; min-width: 140px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 30, 60, .12);
}
.me-panel a, .me-panel button {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); text-align: left; font-size: 13px;
}
.me-panel a:hover, .me-panel button:hover { background: #f4f6fa; }
.me-panel form { margin: 0; }

/* ---------- 页中 ---------- */
.content { padding: 20px 24px 40px; max-width: 1400px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 700; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }
.page-head-actions form { margin: 0; }
.file-hide { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.drop { position: relative; border: 1px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; margin-bottom: 14px; cursor: pointer; }
.drop.is-over { border-color: var(--blue); background: #f3f8ff; }
.drop p { margin: 0; font-size: 13px; }
label.btn { position: relative; cursor: pointer; }
.btn-danger { background: #ff4d4f; color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-row-3 { grid-template-columns: repeat(3, 1fr); }
.stat-row-5 { grid-template-columns: repeat(5, 1fr); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; padding: 16px 20px 20px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #f4f6fa; display: block; }
.photo-grid figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); }
.day-head { margin: 8px 20px 0; font-size: 14px; font-weight: 700; }
.person-head { margin: 12px 20px 0; font-size: 13px; color: var(--muted); }
.stat {
  display: flex; flex-direction: column; gap: 8px; min-height: 96px; padding: 16px 18px;
  border-radius: 16px; color: #fff; text-align: left;
}
a.stat:hover { filter: brightness(1.04); }
.stat.is-on { outline: 2px solid #000; outline-offset: 2px; }
.stat-name { font-size: 13px; }
.stat-num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-purple { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-pink { background: linear-gradient(135deg, #f093fb, #f5576c); }
.stat-blue { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.stat-green { background: linear-gradient(135deg, #43e97b, #38f9d7); }

/* ---------- 正文：白卡片 ---------- */
.card { background: #fff; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 16px; overflow: hidden; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-header h3 { font-size: 14px; font-weight: 700; }
.card-body { padding: 20px; }
.card-narrow { max-width: 460px; }

.filter { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 14px 20px; }
.filter-item { display: flex; align-items: center; gap: 8px; }
.filter-item > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.input-search { width: 330px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 400;
  color: var(--muted); background: #f7f8fa; white-space: nowrap;
}
.table td { padding: 10px 12px; font-size: 13px; border-top: 1px solid var(--line); vertical-align: middle; }
.table td.strong { font-weight: 700; }
.table td.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.badge-ok { background: #e8f8ee; color: #1f9d55; }
.badge-off { background: #f1f1f4; color: var(--muted); }

.ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ops form { margin: 0; }
.op {
  height: 25px; width: 50px; padding: 0; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 23px; text-align: center;
}
.op-wide { width: 74px; }
.op:hover { border-color: #cfd3e0; color: var(--text); }
.op-danger { background: var(--red); border-color: var(--red); color: #fff; }
a.op { display: inline-block; text-decoration: none; }

/* ---------- 页脚 ---------- */
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.page-info { color: var(--muted); font-size: 13px; margin-right: 8px; }
.pagination { display: flex; align-items: center; gap: 8px; }
.page-btn {
  height: 32px; min-width: 32px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.page-btn.page-edge { padding: 0 12px; margin: 0 8px; }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn.off { color: #c4c7d4; background: #fafafc; }
a.page-btn:hover { border-color: var(--blue); }
.page-gap { color: var(--muted); }

/* ---------- 表单、按钮 ---------- */
.form-label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.form-input {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid #d9dce6; border-radius: 8px;
  background: #fff; font-size: 13px;
}
.filter .form-input { width: auto; min-width: 110px; }
.filter .input-search { width: 330px; }
.form-input:focus { outline: 2px solid rgba(30, 91, 184, .25); border-color: var(--blue); }
.hint { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.note { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 8px; }
.form-error { margin-bottom: 8px; padding: 10px 12px; border-radius: 8px; background: #fff1f0; color: #c0322f; font-size: 13px; }
.form-actions { margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 16px;
  border-radius: 8px; border: 1px solid transparent; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #174a97; }
.btn-ghost { background: #fff; color: var(--text); border-color: #d9dce6; }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-block { width: 100%; height: 40px; margin-top: 16px; }

/* ---------- 弹窗 ---------- */
.modal {
  width: min(640px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 12px;
  background: #fff; color: var(--text); box-shadow: 0 20px 60px rgba(10, 20, 50, .3);
}
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 20, 40, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 14px; font-weight: 700; }
.modal-x { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); }
.modal-x:hover { background: #f4f6fa; }
.modal-body { padding: 4px 20px 16px; }
.modal-body p { font-size: 13px; line-height: 1.7; margin-top: 8px; }
.modal-foot { display: flex; justify-content: flex-start; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.view p { margin-top: 0; font-size: 13px; font-weight: 500; min-height: 20px; }
.secret { margin-top: 12px; padding: 14px; border-radius: 8px; background: #f7f8fa; text-align: center; }
.secret code { font-family: Consolas, "Courier New", monospace; font-size: 20px; letter-spacing: 2px; font-weight: 700; user-select: all; }

/* ---------- 提示 ---------- */
.toast-stack { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(560px, calc(100vw - 32px)); }
.toast { padding: 10px 16px; border-radius: 8px; font-size: 13px; line-height: 1.6; box-shadow: 0 6px 20px rgba(20, 30, 60, .15); cursor: pointer; }
.toast.is-ok { background: #1f9d55; color: #fff; }
.toast.is-bad { background: #d9363e; color: #fff; }

/* ---------- 登录页、出错页（不套外壳） ---------- */
.plain-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #e7f2ee; }
.gate {
  background:
    linear-gradient(180deg, rgba(232, 244, 239, .2), rgba(232, 244, 239, .55)),
    url("/static/river.svg") center / cover no-repeat;
}
.login-box { width: min(380px, 100%); padding: 32px 28px 28px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(30, 60, 120, .1); }
.login-mark { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, #0d3a7a, #1E5BB8); }
.login-box h1 { text-align: center; font-size: 20px; font-weight: 700; }
.login-sub { text-align: center; margin: 6px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.login-msg { margin: 10px 0; padding: 9px 12px; border-radius: 8px; background: #eef6ff; color: #1b4f9c; font-size: 13px; line-height: 1.6; }
.login-msg.is-bad { background: #fff1f0; color: #c0322f; }
.login-or { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.span-2 { grid-column: 1 / -1; }
.facts { display: grid; gap: 10px; }
.facts div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-size: 13px; }
.site { background: #f6f7fb; }
.site-top { background: #0d3a7a; color: #fff; }
.site-bar { display: flex; justify-content: space-between; align-items: center; min-height: 60px; gap: 12px; }
.site-bar a { color: #fff; text-decoration: none; }
.site-wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.site main { padding-top: 28px; padding-bottom: 40px; }
.site h1 { font-size: 24px; font-weight: 700; margin: 8px 0 12px; }
.site h2 { font-size: 16px; margin: 28px 0 12px; }
.site-en, .site-foot { color: var(--muted); font-size: 13px; }
.site-lead { font-size: 15px; }
.site-projects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.site-projects article { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.site-projects h3 { font-size: 14px; margin: 0 0 6px; }
.site-projects p, .site p { margin: 0 0 8px; }
.site-briefs { list-style: none; padding: 0; margin: 0; }
.site-briefs li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.site-briefs a { color: var(--text); }
.site-foot { border-top: 1px solid var(--line); padding: 20px 0 32px; }
.site-foot a { color: var(--muted); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-or + .btn-block { margin-top: 12px; }

/* ---------- 手机 ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
  body.nav-open .sidebar-mask { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(10, 20, 40, .45); }
  .main { margin-left: 0; }
  .nav-toggle { display: grid; }
  .topbar { padding: 0 14px; }
  .content { padding: 16px 14px 32px; }
  .stat-row, .stat-row-5 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-row-3 { grid-template-columns: 1fr; }
  .stat-row-3 .stat { min-height: 84px; }
  .site-projects { grid-template-columns: 1fr; }
  .filter { align-items: stretch; }
  .filter-item { flex: 1 1 100%; }
  .filter-item .form-input, .filter .input-search { width: 100%; flex: 1; }
  .who { display: none; }
}
@media (max-width: 768px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; }
  .table td { display: flex; justify-content: space-between; gap: 16px; border: 0; padding: 5px 0; text-align: right; }
  .table td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12px; text-align: left; }
  .table td.empty { display: block; text-align: center; }
  .table td.empty::before { content: none; }
  .table td[data-label="操作"] { flex-wrap: wrap; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-info { width: 100%; text-align: center; margin: 0; }
}
