/* =============================================================
 * theme.css — 眼科管理系统设计系统
 * ============================================================= */
:root {
  --brand: #2f6bff;
  --brand-dark: #1e4fd8;
  --brand-weak: #eaf0ff;
  --teal: #00b8a9;
  --teal-weak: #e2f7f4;
  --amber: #f6a623;
  --amber-weak: #fff5e3;
  --rose: #ef5f6b;
  --rose-weak: #ffeef0;
  --violet: #8b5cf6;
  --violet-weak: #f2ecff;
  --sky: #38bdf8;
  --sky-weak: #e6f6fe;

  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --line: #e4eaf3;
  --line-strong: #d3dceb;
  --text: #16202f;
  --text-2: #4a5a70;
  --muted: #8b98ab;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-1: 0 1px 2px rgba(20, 40, 80, .05), 0 6px 18px rgba(20, 40, 80, .06);
  --shadow-2: 0 12px 40px rgba(20, 40, 80, .14);
  --font: "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.no-scroll { overflow: hidden; }

a { color: var(--brand); text-decoration: none; }

.muted { color: var(--muted); }
.text-ok { color: var(--teal); }
.text-warn { color: var(--amber); }
.text-danger { color: var(--rose); }
.text-brand { color: var(--brand); }
.strong { font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(47, 107, 255, .26); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-teal { background: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(0, 184, 169, .24); }
.btn-teal:hover { filter: brightness(.94); }
.btn-amber { background: var(--amber); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }
.btn-soft { background: var(--brand-weak); color: var(--brand); }
.btn-danger { background: var(--rose); color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.link-btn {
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
}
.link-btn:hover { background: var(--brand-weak); }
.link-danger { color: var(--rose); }
.link-danger:hover { background: var(--rose-weak); }
.link-ok { color: var(--teal); }
.link-ok:hover { background: var(--teal-weak); }
.link-amber { color: var(--amber); }
.link-amber:hover { background: var(--amber-weak); }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag-ok { background: var(--teal-weak); color: #08917f; border-color: #c6ece7; }
.tag-warn { background: var(--amber-weak); color: #b87708; border-color: #f8e0b5; }
.tag-info { background: var(--brand-weak); color: var(--brand); border-color: #cfdcff; }
.tag-danger { background: var(--rose-weak); color: #d63a48; border-color: #f8cdd2; }
.tag-violet { background: var(--violet-weak); color: #6d3fd4; border-color: #ddd0fb; }
.tag-muted { background: var(--surface-2); color: var(--muted); }

/* ---------------- 表格 ---------------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f7faff; }
.data-table .col-act { white-space: nowrap; text-align: right; }
.data-table th.col-act { text-align: right; }

.empty-cell { padding: 0; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-ico {
  display: block;
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b4c4' stroke-width='1.6' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>") center/24px no-repeat;
  border: 1px solid var(--line);
}
.empty p { margin: 0; font-size: 13px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.pager-box { display: flex; align-items: center; gap: 8px; }
.page-btn {
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-now { color: var(--text-2); font-weight: 500; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(18, 30, 50, .42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
  animation: fadeIn .16s ease;
}
.modal {
  width: 520px;
  max-width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  animation: popIn .2s cubic-bezier(.2, .9, .3, 1.1);
}
.modal-lg { width: 760px; }
.modal-sm { width: 400px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-x {
  width: 30px; height: 30px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.modal-x:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 20px; overflow: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.confirm-text { margin: 0; color: var(--text-2); line-height: 1.7; font-size: 14px; }

/* ---------------- 表单 ---------------- */
.form-item { margin-bottom: 15px; }
.form-item.span-2 { }
.form-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}
.form-item label .req { color: var(--rose); font-style: normal; margin-left: 3px; }
.form-ctl {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.form-ctl { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.6; }
.form-ctl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
.form-ctl[readonly] { background: var(--surface-2); color: var(--muted); }
.form-hint { margin: 5px 0 0; font-size: 11.5px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------------- Toast ---------------- */
.toast-box {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border-radius: 22px;
  background: rgba(22, 32, 47, .92);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-2);
  animation: toastIn .22s cubic-bezier(.2, .9, .3, 1.1);
}
.toast.out { animation: toastOut .26s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
.toast-ico { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.toast-ok .toast-ico { background: var(--teal); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .28); }
.toast-warn .toast-ico { background: var(--amber); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .28); }
.toast-err .toast-ico { background: var(--rose); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .28); }

/* ---------------- 图表 ---------------- */
.chart { width: 100%; height: auto; display: block; color: var(--text); }
.chart-label { font-size: 10.5px; fill: var(--muted); font-family: var(--font); }
.chart-center-num { font-size: 22px; font-weight: 700; fill: var(--text); font-family: var(--font); }
.chart-center-label { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.chart-donut { max-width: 168px; margin: 0 auto; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
