/* 护士端样式。手机优先：输入框 ≥16px（iOS 聚焦不放大）、按钮 ≥48px、底部操作条避让安全区。
   CSP 禁止内联样式，所有样式都在这个文件里。 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2125;
  --muted: #5f6b76;
  --faint: #8b96a0;
  --line: #dde1e6;
  --accent: #1f6feb;
  --accent-bg: #e8f0fe;
  --accent-text: #174ea6;
  --warn-bg: #fff4d6;
  --warn-text: #7a4b00;
  --danger: #c62828;
  --danger-bg: #fde8e8;
  --danger-text: #9b1c1c;
  --ok-bg: #e6f4ea;
  --ok-text: #1e6b34;
  --copied-bg: #eef6ff;
  --radius: 10px;
  --tap: 48px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}
[hidden] { display: none !important; }

.banner {
  background: var(--warn-bg);
  color: var(--warn-text);
  text-align: center;
  font-size: 14px;
  padding: 6px 16px;
  padding-top: max(6px, env(safe-area-inset-top));
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px calc(96px + env(safe-area-inset-bottom));
}

/* —— 顶栏 —— */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  margin: 0 -16px; padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .btn { min-height: 40px; padding: 0 12px; }

/* —— 按钮 —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-text { border-color: transparent; background: transparent; color: var(--accent); padding: 0 8px; }
.btn-text.danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 10px; font-size: 14px; }

/* —— 表单 —— */
.field { display: block; margin: 12px 0; }
.field-label { display: flex; align-items: baseline; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field-label .req { color: var(--danger); }
.field-hint { font-size: 13px; color: var(--faint); margin-top: 4px; }
.field-error { font-size: 13px; color: var(--danger); margin-top: 4px; }
.field-warn { font-size: 13px; color: var(--warn-text); background: var(--warn-bg); border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* 低于 16px 时 iOS Safari 聚焦会自动放大页面 */
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.input.invalid { border-color: var(--danger); }
.input.copied { background: var(--copied-bg); }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; min-width: 0; }
.unit { color: var(--muted); font-size: 14px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); font: inherit; font-size: 14px; color: var(--accent-text); cursor: pointer; }

/* 分段选择：空 / 无 / 有，左 / 右，男 / 女 */
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button {
  flex: 1; min-height: var(--tap); border: 0; border-left: 1px solid var(--line);
  background: transparent; font: inherit; font-size: 16px; color: var(--text); cursor: pointer;
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button.seg-empty { color: var(--faint); flex: 0.7; }
.seg button.seg-empty[aria-pressed="true"] { background: #e9ecef; color: var(--muted); }
.seg.copied { background: var(--copied-bg); }

/* —— 卡片与分段 —— */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 12px 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 4px; font-size: 15px; font-weight: 600; color: var(--muted); }
.group { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px 12px; margin: 10px 0; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.group-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.group-body { border-top: 1px dashed var(--line); margin-top: 6px; }
.group.copied { background: var(--copied-bg); }

/* —— 列表 —— */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.row-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; color: inherit; text-decoration: none; }
.row-link:active { background: #f0f2f5; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; }
.chev { color: var(--faint); }
.gap-row { padding: 8px 16px; font-size: 14px; color: var(--faint); background: #fafbfc; }

.badge { display: inline-block; font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 10px; background: #eef0f3; color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); }
.badge.info { background: var(--accent-bg); color: var(--accent-text); }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }

.search { position: sticky; top: 57px; z-index: 4; background: var(--bg); padding: 8px 0; }
.summary { background: var(--accent-bg); color: var(--accent-text); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0; }
.kv { display: grid; grid-template-columns: 7.5em 1fr; gap: 4px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.notice { background: var(--warn-bg); color: var(--warn-text); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0; }
.error-box { background: var(--danger-bg); color: var(--danger-text); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0; }
.stack > * + * { margin-top: 8px; }

/* —— 底部操作条 —— */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; gap: 8px; justify-content: center;
  background: rgba(246, 247, 249, 0.96);
  border-top: 1px solid var(--line);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
}
.bottombar .btn { flex: 1; max-width: 360px; }

/* —— 冲突对照 —— */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare .card { margin: 0; }
.choice-row { border-top: 1px solid var(--line); padding: 8px 0; }

/* —— 登录 —— */
.login { max-width: 360px; margin: 12vh auto 0; }
.login h1 { font-size: 22px; text-align: center; margin-bottom: 24px; }

/* —— 对话框与提示 —— */
.dialog { border: 0; border-radius: 14px; padding: 20px; width: min(92vw, 420px); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.dialog-title { margin: 0 0 8px; font-size: 18px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.dialog-actions .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 20;
  bottom: calc(88px + env(safe-area-inset-bottom));
  background: rgba(29, 33, 37, 0.92); color: #fff;
  padding: 10px 16px; border-radius: 20px; font-size: 15px; max-width: 90vw;
}

@media (min-width: 720px) {
  .app { padding-left: 24px; padding-right: 24px; }
  .topbar { margin: 0 -24px; padding: 8px 24px; }
}

.list-plain { list-style: none; margin: 0; padding: 0; }
details summary { cursor: pointer; padding: 4px 0; }
.card > .section-title:first-child { margin-top: 0; }
.card .list { border-radius: 10px; }
