/* 中药代煎协议 · PC 管理后台（浅色主题，手机端也可应急使用） */
:root {
  --green: #0e7a5f;
  --green-lt: #16a37c;
  --bg: #f2f5f7;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #7d8d99;
  --line: #e6ebef;
  --red: #d4382c;
  --amber: #d98b1f;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 45, 65, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
a { color: var(--green); text-decoration: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  background: #0f2f42;
  color: #cfe0e8;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 22px 20px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .logo {
  width: 34px; height: 34px; line-height: 34px; text-align: center;
  background: var(--green); border-radius: 8px; font-size: 19px;
}
.menu { flex: 1; padding: 14px 0; overflow-y: auto; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 22px; color: #b9cede; font-size: 14.5px;
  border-left: 3px solid transparent;
}
.menu a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.menu a.active { background: rgba(14, 122, 95, 0.22); color: #fff; border-left-color: var(--green-lt); }
.menu .ico { width: 20px; text-align: center; }
.side-foot { padding: 16px 20px; font-size: 12.5px; color: #6f8a9c; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; }
.topbar {
  background: #fff; padding: 0 28px; height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar .who { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 14px; }
.content { padding: 24px 28px 60px; }

/* ---------- 卡片与统计 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat .t { color: var(--muted); font-size: 13px; margin-top: 4px; }
.stat.green .n { color: var(--green); }
.stat.amber .n { color: var(--amber); }
.stat.red .n { color: var(--red); }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-hd {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.panel-hd h2 { margin: 0; font-size: 16px; font-weight: 600; }
.panel-bd { padding: 18px 20px; }
.panel-bd.flush { padding: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f7fafb; color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #fafcfd; }
td .sub { color: var(--muted); font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--green); color: #fff; font-size: 14px; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { background: var(--green-lt); }
.btn.ghost { background: #fff; color: var(--green); border-color: #bfe0d5; }
.btn.ghost:hover { background: #f2fbf7; }
.btn.gray { background: #eef2f5; color: #5a6b7a; }
.btn.gray:hover { background: #e4eaef; }
.btn.danger { background: #fff; color: var(--red); border-color: #f0c4bf; }
.btn.danger:hover { background: #fdf3f2; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; color: #4a5b6a; margin-bottom: 6px; }
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d9e1e7; border-radius: 8px;
  font: inherit; font-size: 14px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(14,122,95,.12); }
.field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; }
.filters input, .filters select { height: 36px; padding: 0 12px; border: 1px solid #d9e1e7; border-radius: 8px; font-size: 14px; }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 12.5px; line-height: 20px; }
.tag-pending { background: #fff4e0; color: #a56800; }
.tag-signed { background: #e6f7ef; color: var(--green); }
.tag-void { background: #eef2f5; color: #7d8d99; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 30, 45, .5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 620px;
  max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
}
.modal.wide { max-width: 860px; }
.modal-hd { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-hd h3 { margin: 0; font-size: 16.5px; }
.modal-bd { padding: 20px 22px; }
.modal-ft { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.close { background: none; border: none; font-size: 24px; color: var(--muted); cursor: pointer; line-height: 1; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: #123; color: #fff; padding: 11px 20px; border-radius: 8px;
  z-index: 200; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ico { font-size: 42px; opacity: .4; margin-bottom: 10px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 16px 20px; color: var(--muted); font-size: 14px; }

.img-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; background: #fafbfc; }

.bindcode {
  font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: 2px;
  background: #f2fbf7; color: var(--green); padding: 4px 10px; border-radius: 6px; border: 1px dashed #bfe0d5;
}

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2f42 0%, #14503f 100%); padding: 20px;
}
.login-box { width: 100%; max-width: 400px; }
.login-card { background: #fff; border-radius: 16px; padding: 34px 32px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-title { font-size: 22px; font-weight: 600; text-align: center; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.login-card .btn { width: 100%; height: 42px; font-size: 15px; margin-top: 8px; }
.login-tip { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; line-height: 1.7; }

/* ---------- 手机适配（老板临时用手机看后台） ---------- */
@media (max-width: 860px) {
  .sidebar { width: 62px; }
  .brand span { display: none; }
  .menu a { padding: 14px 0; justify-content: center; border-left-width: 0; border-top: 3px solid transparent; }
  .menu a.active { border-top-color: var(--green-lt); border-left: none; }
  .menu a .txt { display: none; }
  .menu a .ico { font-size: 19px; }
  .side-foot { display: none; }
  .content { padding: 16px 14px 50px; }
  .topbar { padding: 0 16px; }
  .topbar h1 { font-size: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}
