/* ============================================================
 * admin.css —— 后台界面样式
 * 复用 base.css 的设计变量，仅补充后台专属组件
 * ============================================================ */

body { background: #eef1f2; }

/* ---------- 登录遮罩 ---------- */
.gate {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}
.gate-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
}
.gate-logo { font-size: 38px; text-align: center; }
.gate h2 { margin: 8px 0 4px; font-size: 19px; text-align: center; }
.gate-desc { margin: 0 0 16px; font-size: 13px; color: var(--txt2); text-align: center; }
.gate-box input {
  width: 100%;
  padding: 12px 13px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 10px;
  outline: none;
}
.gate-box input:focus { border-color: var(--brand); }
.gate-err {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
  line-height: 1.5;
}
.gate-tip {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--txt3);
  line-height: 1.6;
  text-align: center;
}

/* KV 未绑定的醒目提示：这类配置问题如果不说清楚，
   用户只会看到「口令不正确」，白白浪费时间 */
.kvwarn {
  background: var(--danger-l);
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.75;
}
.kvwarn b {
  display: block;
  font-size: 13.5px;
  margin-bottom: 6px;
}
.kvwarn ol {
  margin: 6px 0 8px;
  padding-left: 18px;
}
.kvwarn li { margin-bottom: 3px; }
.kvwarn code {
  background: rgba(0, 0, 0, .06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}
.gate-tip code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

/* ---------- 通用按钮 ---------- */
.btn-primary, .btn-ghost, .btn-danger {
  border: none;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: filter .15s;
}
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--txt2); border: 1px solid var(--line); }
.btn-danger { background: var(--danger-l); color: var(--danger); border: 1px solid #fecaca; }
.btn-primary:not(:disabled):hover,
.btn-ghost:hover,
.btn-danger:hover { filter: brightness(.96); }

/* ---------- 头部 ---------- */
.adm-hd {
  background: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}
.adm-hd-l { flex: 1; min-width: 200px; }
.adm-hd h1 { margin: 0; font-size: 18px; }
.adm-meta { font-size: 12px; color: var(--txt3); margin-top: 2px; }
.adm-hd-r { display: flex; gap: 8px; }

/* ---------- 保存栏 ---------- */
.savebar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dirty { flex: 1; font-size: 13px; color: var(--txt3); }
.dirty.on { color: var(--warn); font-weight: 600; }
.savebar .btn-primary { width: auto; }

/* ---------- 提示条 ---------- */
.msg {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13.5px;
}
.msg.ok  { background: var(--brand-l); color: var(--brand-d); border: 1px solid #99f6e4; }
.msg.err { background: var(--danger-l); color: var(--danger); border: 1px solid #fecaca; }

/* ---------- Tab ---------- */
.adm-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.adm-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--txt2);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  cursor: pointer;
}
.adm-tabs button.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.pane { display: none; }
.pane.on { display: block; }

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input[type=search] {
  flex: 1;
  min-width: 180px;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  outline: none;
}
.toolbar input:focus { border-color: var(--brand); }
.hint { font-size: 12px; color: var(--txt3); }
.hint code, .bulk-fmt code, .adm-note code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
}

/* ---------- 卡片块 ---------- */
.blk {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}
.blk-hd {
  padding: 11px 14px;
  background: var(--brand-l);
  color: var(--brand-d);
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.blk-hd .cnt { font-weight: 400; font-size: 12px; opacity: .8; }
.blk-hd .sp { flex: 1; }
.blk-bd { padding: 12px 14px; }
.blk.fold .blk-bd { display: none; }

/* ---------- 表单行 ---------- */
.fld { margin-bottom: 10px; }
.fld label {
  display: block;
  font-size: 12.5px;
  color: var(--txt2);
  margin-bottom: 3px;
  font-weight: 500;
}
.fld input[type=text], .fld textarea, .fld select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
}
.fld input:focus, .fld textarea:focus { border-color: var(--brand); }
.fld textarea { line-height: 1.6; }
.fld-row { display: flex; gap: 8px; align-items: center; }
.fld-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); }
.fld-row label { margin: 0; font-size: 13.5px; color: var(--txt); cursor: pointer; }

.mini {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--txt2);
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.mini:hover { background: #f9fafb; }
.mini.del { color: var(--danger); border-color: #fecaca; }
.mini.del:hover { background: var(--danger-l); }

/* ---------- 药箱条目 ---------- */
.kitem {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  margin-bottom: 8px;
  background: #fcfcfd;
}
.kitem .krow1 { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.kitem .kname { flex: 1; font-weight: 600; font-size: 14.5px; }
.kitem .core-tag {
  font-size: 10px;
  color: var(--brand-d);
  background: var(--brand-l);
  border: 1px solid #99f6e4;
  border-radius: 4px;
  padding: 0 5px;
}

/* ---------- 批量粘贴 ---------- */
.bulk, .tpl {
  background: #fff;
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}
.bulk-hd { font-weight: 700; font-size: 14px; color: var(--brand-d); margin-bottom: 8px; }
.bulk-fmt { font-size: 12px; color: var(--txt3); line-height: 1.7; margin-bottom: 8px; }
.bulk textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  font-size: 13.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}
.bulk textarea:focus { border-color: var(--brand); }
.bulk-act { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bulk-act input {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.bulk-act .btn-primary { width: auto; }
.bulk-preview {
  margin-top: 10px;
  padding: 10px;
  background: #f9fafb;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  max-height: 260px;
  overflow: auto;
  line-height: 1.7;
}
.bulk-preview .ok { color: var(--brand-d); }
.bulk-preview .bad { color: var(--danger); }

/* ---------- 模板库 ---------- */
.tpl-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-list button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--txt2);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.tpl-list button:hover { background: var(--brand-l); border-color: #99f6e4; color: var(--brand-d); }

/* ---------- 症状卡 ---------- */
.sym { margin-bottom: 10px; }
.sym .fld { margin-bottom: 8px; }
.med-edit {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 7px;
  background: #fcfcfd;
}
.med-edit .me-hd { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.med-edit .me-hd .sp { flex: 1; font-size: 12.5px; color: var(--txt3); font-weight: 600; }

/* 高亮勾选：勾上后该药在前台会橙色突出显示 */
.me-key {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--txt2);
  cursor: pointer;
  user-select: none;
}
.me-key input { width: 15px; height: 15px; accent-color: var(--brand); margin: 0; }

/* ---------- 铁律 / 信号 ---------- */
.rule-edit { border-bottom: 1px dashed var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.rule-edit:last-child { border-bottom: none; }
.flag-item { display: flex; gap: 6px; margin-bottom: 6px; align-items: flex-start; }
.flag-item textarea { flex: 1; }

/* ---------- 导入导出 ---------- */
.io-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.io-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}
.io-card h3 { margin: 0 0 6px; font-size: 15px; color: var(--brand-d); }
.io-card p { margin: 0 0 10px; font-size: 12.5px; color: var(--txt2); line-height: 1.7; }
.io-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.io-card input[type=file] { font-size: 13px; }
.io-info { font-size: 12.5px; color: var(--txt2); margin-top: 8px; line-height: 1.7; }
.io-stats { font-size: 13px; line-height: 1.9; color: var(--txt2); }
.io-stats b { color: var(--txt); font-size: 15px; }

.adm-note {
  font-size: 12px;
  color: var(--txt3);
  text-align: center;
  margin: 20px 0 40px;
  line-height: 1.8;
}

/* ---------- 确认弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
}
.modal-box {
  background: #fff;
  border-radius: 13px;
  padding: 20px;
  max-width: 360px;
  width: 100%;
}
.modal-box > div:first-child { font-size: 14.5px; margin-bottom: 16px; line-height: 1.7; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- 小屏 ---------- */
@media (max-width: 560px) {
  .adm-hd-r { width: 100%; }
  .savebar { position: static; }
  .adm-tabs button { flex: 1 1 44%; font-size: 13px; }
}
