/* ============================================================
   基础样式（用户端 / 后台共用）
   ============================================================ */
:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-2: #4a5568;
  --muted: #8a94a6;
  --line: #e8ecf3;
  --brand: #2f6bff;
  --brand-dark: #1f4fd8;
  --brand-soft: #eef3ff;
  --ok: #0ea472;
  --ok-soft: #e6f7f1;
  --warn: #e8990c;
  --warn-soft: #fef5e4;
  --danger: #e5484d;
  --danger-soft: #fdeceb;
  --sidebar: #161d29;
  --sidebar-2: #1e2734;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .05);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.hidden { display: none !important; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: .16s ease;
  white-space: nowrap;
  border-color: var(--line);
}
.btn:hover { border-color: #d3dbe8; background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #0b8f63; border-color: #0b8f63; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #cf3b40; border-color: #cf3b40; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #f1f4f9; border-color: transparent; }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: .16s ease;
}
.textarea { height: auto; min-height: 78px; padding: 10px 13px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.input::placeholder, .textarea::placeholder { color: #b6bfce; }

/* 去掉数字输入框的上下小箭头，更整洁 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a94a6' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 236, 243, .8);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 20px; }

/* ---------------- 徽章 / 状态 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-review { background: var(--warn-soft); color: var(--warn); }
.badge-doing { background: var(--brand-soft); color: var(--brand); }
.badge-done { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: #f1f3f7; color: var(--muted); }
.badge-on { background: var(--ok-soft); color: var(--ok); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------------- Toast ---------------- */
#toast-wrap {
  position: fixed;
  z-index: 9999;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 180px;
  max-width: 88vw;
  padding: 11px 18px;
  border-radius: 10px;
  background: rgba(28, 36, 48, .93);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, .22);
  animation: toastIn .22s ease;
  backdrop-filter: blur(8px);
}
.toast.ok { background: rgba(14, 164, 114, .96); }
.toast.err { background: rgba(229, 72, 77, .96); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ---------------- 空状态 ---------------- */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.empty .ico { font-size: 34px; opacity: .45; display: block; margin-bottom: 8px; }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(16, 24, 40, .45);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fadeIn .16s ease;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(16, 24, 40, .26);
  animation: modalIn .2s cubic-bezier(.2, .8, .3, 1);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 2;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 20px 20px;
}
.modal-close {
  width: 30px; height: 30px;
  border: none; background: #f4f6fa; border-radius: 8px;
  color: var(--muted); font-size: 17px; cursor: pointer; line-height: 1;
}
.modal-close:hover { background: #e9edf5; color: var(--ink); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* ---------------- 表格（后台） ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left;
  padding: 11px 14px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tb td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f4f9;
  vertical-align: middle;
}
table.tb tr:hover td { background: #fafbfe; }
table.tb tr:last-child td { border-bottom: none; }

.link-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--brand);
}

/* ---------------- 其它 ---------------- */
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.money { color: var(--danger); font-weight: 600; }
.money-in { color: var(--ok); font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dce8; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2ccdd; }
::-webkit-scrollbar-track { background: transparent; }

/* 手机端 */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .card-pad { padding: 16px; }
  .card-body { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 0 16px 16px; }
}
