/* ========== 公共样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  color: #2c3e50;
  background: #f0f4f8;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #2f80ed; color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-danger  { background: #e74c3c; color: #fff; }
.btn-warn    { background: #f39c12; color: #fff; }
.btn-default { background: #e4e9f0; color: #2c3e50; }
.btn-block   { display: block; width: 100%; padding: 12px; font-size: 16px; }
.btn-sm      { padding: 4px 10px; font-size: 12px; }
.btn-link    { background: none; border: none; color: #2f80ed; font-size: 12px; }

/* 表单 */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; margin-bottom: 6px; color: #5a6b7d; }
.form-item input,
.form-item select,
.form-item textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  background: #fff;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus { border-color: #2f80ed; }
.form-row { display: flex; gap: 12px; }
.form-row .form-item { flex: 1; }

/* 表格 */
.table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data-table th, table.data-table td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid #eef2f6; white-space: nowrap;
}
table.data-table th { background: #f7fafd; color: #5a6b7d; font-weight: 600; }
table.data-table tr:hover td { background: #f4f9ff; }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag-green  { background: #e6f7ee; color: #27ae60; }
.tag-orange { background: #fdf3e3; color: #f39c12; }
.tag-blue   { background: #e8f1fd; color: #2f80ed; }
.tag-red    { background: #fdeceb; color: #e74c3c; }
.tag-gray   { background: #eef1f4; color: #7f8c9b; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 35, 55, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 10px; width: 520px; max-width: 92%;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #eef2f6;
}
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; color: #95a5b6; line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #eef2f6; text-align: right; }

/* 空数据 / 提示 */
.empty-tip { padding: 40px; text-align: center; color: #95a5b6; }
.toast {
  position: fixed; left: 50%; top: 20%; transform: translateX(-50%);
  background: rgba(30, 45, 60, .9); color: #fff; padding: 10px 24px;
  border-radius: 6px; z-index: 200; font-size: 14px;
}

/* ========== 处方打印区域（屏幕隐藏，仅打印可见） ========== */
#printArea { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }
  #printArea {
    display: block !important;
    position: fixed; left: 0; top: 0; width: 100%;
    background: #fff; z-index: 99999; padding: 10mm 12mm;
  }
  .rx-paper { color: #000; font-family: "SimSun", "Microsoft YaHei", serif; }
  .rx-head { text-align: center; border-bottom: 2px solid #000; padding-bottom: 10px; }
  .rx-head h1 { font-size: 24px; letter-spacing: 6px; }
  .rx-head p { font-size: 12px; margin-top: 4px; }
  .rx-info {
    display: flex; justify-content: space-between; font-size: 14px;
    padding: 12px 4px; border-bottom: 1px solid #000;
  }
  .rx-section { padding: 12px 4px; font-size: 14px; min-height: 120px; }
  .rx-r { font-size: 22px; font-weight: bold; margin-bottom: 10px; }
  .rx-item { font-size: 15px; line-height: 2.2; padding-left: 2em; }
  .rx-foot {
    display: flex; justify-content: space-between; font-size: 14px;
    padding: 24px 4px 8px; border-top: 1px solid #000; margin-top: 40px;
  }
  .rx-tip { text-align: center; font-size: 12px; color: #555; margin-top: 30px; }
}
