:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --accent: #0f766e;
  --danger: #b91c1c;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
}
.brand h1 { margin: 0; font-size: 19px; font-weight: 700; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 8px; }
.tab {
  border: 1px solid transparent; background: transparent;
  padding: 8px 18px; border-radius: 8px; cursor: pointer;
  font-size: 15px; color: var(--muted); font-family: inherit;
}
.tab:hover { background: #f3f4f6; }
.tab.active { background: #eff4ff; color: var(--primary); border-color: #dbe6ff; font-weight: 600; }

main { max-width: 1100px; margin: 24px auto 60px; padding: 0 20px; }
.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-head { margin-bottom: 22px; }
.card-head.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.card-head h2 { margin: 0 0 4px; font-size: 20px; }
.card-head p { margin: 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 22px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.field .req { color: var(--danger); }
.field input, .field textarea, .modal-box input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text);
  font-family: inherit; font-size: 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .modal-box input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.field textarea { resize: vertical; }
.field small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 14px; cursor: pointer; font-weight: 400;
}
.radio-item input { width: auto; margin: 0; accent-color: var(--primary); }

.form-actions { margin-top: 26px; display: flex; gap: 12px; }

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 18px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-family: inherit; font-weight: 500;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 14px; }
.btn.danger { color: var(--danger); border-color: #fecaca; padding: 5px 10px; font-size: 12px; }

.tip-card { background: #f8fafc; }
.tip-card h3 { margin: 0 0 8px; font-size: 15px; }
.tip-card ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; }

.date-filter { display: flex; align-items: center; gap: 8px; }
.date-filter label { font-size: 13px; color: var(--muted); }
.date-filter input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.stat {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; text-align: center;
}
.stat-num { display: block; font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #f8fafc; font-weight: 600; color: #374151; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
td.empty { text-align: center; color: var(--muted); padding: 30px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; }
.tag.yes { background: #fef2f2; color: #b91c1c; }
.tag.no { background: #f0fdf4; color: #15803d; }

.toolbar { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal.hidden, .toast.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 14px; padding: 26px;
  max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-box h3 { margin: 0 0 8px; font-size: 18px; }
.modal-box label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 14px; }
.modal-box .muted { color: var(--muted); font-size: 13px; margin: 0; }
.check-line { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check-line input { width: auto; accent-color: var(--primary); }
.modal-actions { margin-top: 22px; display: flex; gap: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 100; box-shadow: var(--shadow);
}

.code-result {
  margin-top: 24px; padding: 18px;
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
}
.code-result.hidden { display: none; }
.code-result h3 { margin: 0 0 4px; font-size: 16px; color: #166534; }
.code-result .muted { color: #15803d; }
.code-result textarea {
  width: 100%; margin-top: 10px; padding: 10px;
  border: 1px solid #86efac; border-radius: 8px;
  font-family: Consolas, Monaco, monospace; font-size: 12px;
  word-break: break-all; resize: vertical; background: #fff; color: #166534;
}
.modal-box.wide { max-width: 620px; }
.modal-box textarea {
  width: 100%; margin-top: 12px; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: Consolas, Monaco, monospace; font-size: 12px;
  resize: vertical; word-break: break-all;
}

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .header-inner { align-items: flex-start; }
}
