/* ============================================================
 * 处方管理系统 - 公共样式（含登录/选择页）
 * ============================================================ */
:root {
  --primary: #1a73c9;
  --primary-dark: #125a9e;
  --primary-light: #e8f2fb;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #8492a6;
  --border: #e4e9f0;
  --success: #21a366;
  --success-light: #e6f7ef;
  --warning: #e6a23c;
  --warning-light: #fdf3e3;
  --danger: #e04b4b;
  --danger-light: #fdeaea;
  --info: #6b7a90;
  --info-light: #eef1f6;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(31, 45, 61, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; color: #fff; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 11px 16px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { border: none; background: none; color: var(--muted); }
.btn-link:hover { color: var(--primary); }

/* ---------------- 表单 ---------------- */
.input, select.input, textarea.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 115, 201, .12); }
.form-label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.form-row { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: #f7fafd; color: var(--muted); font-weight: 600; font-size: 13px; }
.table tr:hover td { background: #f9fbfd; }
.table .c { text-align: center; }
.table .r { text-align: right; }
.table .ops .btn { margin-right: 4px; }
.table .ops .btn:last-child { margin-right: 0; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 20px;
}
.badge.st-pending { background: var(--warning-light); color: var(--warning); }
.badge.st-audited { background: var(--primary-light); color: var(--primary); }
.badge.st-done { background: var(--success-light); color: var(--success); }
.badge.stock-low { background: var(--danger-light); color: var(--danger); }
.badge.stock-ok { background: var(--success-light); color: var(--success); }

/* ---------------- 卡片 ---------------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* ---------------- 弹窗 ---------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 30, 50, .45);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  animation: pop .18s ease;
}
.modal-box.modal-wide { max-width: 980px; }
.modal-box.modal-md { max-width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- 提示 ---------------- */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: rgba(31, 45, 61, .92); color: #fff;
  padding: 10px 22px; border-radius: 24px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty-tip { text-align: center; color: var(--muted); padding: 40px 0; }

/* ============================================================
 * 登录 / 版本选择页
 * ============================================================ */
.index-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #125a9e 0%, #1a73c9 45%, #2fa4b7 100%);
  position: relative; overflow: hidden;
}
.index-bg::before, .index-bg::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08);
}
.index-bg::before { width: 480px; height: 480px; top: -160px; right: -120px; }
.index-bg::after { width: 360px; height: 360px; bottom: -140px; left: -100px; }

.login-card {
  position: relative; z-index: 2;
  width: 380px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 16px;
  padding: 36px 34px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  animation: pop .25s ease;
}
.login-logo {
  width: 60px; height: 60px; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary), #2fa4b7);
  color: #fff; font-size: 30px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: 16px;
}
.login-card h1 { text-align: center; font-size: 22px; }
.login-sub { text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0 8px; letter-spacing: 1px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0 4px; }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

.select-wrap {
  position: relative; z-index: 2;
  flex-direction: column; align-items: center;
  width: 100%; max-width: 720px; padding: 20px;
}
.select-title { color: #fff; font-size: 26px; text-align: center; }
.select-sub { color: rgba(255, 255, 255, .75); margin: 6px 0 28px; }
.select-cards { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.select-card {
  width: 240px; background: #fff; border-radius: 16px;
  padding: 34px 20px 28px; text-align: center; cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  transition: transform .18s, box-shadow .18s;
}
.select-card:hover { transform: translateY(-6px); box-shadow: 0 20px 44px rgba(0, 0, 0, .25); }
.select-icon { font-size: 52px; }
.select-name { font-size: 19px; font-weight: 600; margin-top: 12px; }
.select-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------------- 统计图 ---------------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-card .num { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .icon { float: right; font-size: 26px; opacity: .85; }
.stat-primary .num { color: var(--primary); }
.stat-success .num { color: var(--success); }
.stat-warning .num { color: var(--warning); }
.stat-danger .num { color: var(--danger); }

.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 180px; padding: 10px 6px 0; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-val { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.bar { width: 70%; max-width: 46px; background: linear-gradient(180deg, #3f9be0, var(--primary)); border-radius: 6px 6px 0 0; min-height: 4px; }
.bar-label { font-size: 12px; color: var(--muted); margin-top: 8px; }

.hbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.hbar-name { width: 90px; color: var(--text); flex-shrink: 0; }
.hbar-track { flex: 1; background: var(--info-light); border-radius: 6px; height: 18px; overflow: hidden; }
.hbar-fill { height: 100%; background: linear-gradient(90deg, #2fa4b7, var(--primary)); border-radius: 6px; min-width: 3px; }
.hbar-val { width: 90px; text-align: right; color: var(--muted); font-size: 13px; flex-shrink: 0; }
