/* 《了不起的中医》在线咨询 —— 通用样式
   访客网站 (index.html) 与 客服/医生工作台 (admin.html) 共用
   主题：中医风（宣纸底、青绿主色、暖金点缀） */

:root {
  /* 中医风配色 */
  --bg: #f7f2ea;
  --surface: #fffdf8;
  --surface-2: #faf5ed;
  --surface-3: #f0e8d8;
  --line: #e8dcc8;
  --line-strong: #d4c4a8;
  --ink: #2c2418;
  --ink-2: #6b5e4e;
  --ink-3: #9e8e78;
  --brand: #2d6a4f;
  --brand-2: #40916c;
  --brand-ink: #1b4332;
  --brand-soft: #e8f0e8;
  --accent: #a63a2e;
  --accent-soft: #f8ebe8;
  --warn: #b8860b;
  --ok: #2d6a4f;
  --gold: #c8973e;
  --gold-soft: #faf3e2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 3px rgba(44, 36, 24, .07), 0 2px 10px rgba(44, 36, 24, .05);
  --shadow-2: 0 6px 24px rgba(44, 36, 24, .12);
  --shadow-3: 0 18px 48px rgba(44, 36, 24, .18);
  --head-h: 60px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(45, 106, 79, .04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(200, 151, 62, .04) 0%, transparent 50%);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 标题使用衬线字体，更有中医韵味 */
h1, h2, h3, .hero h1, .brand-text, .card-name h3 {
  font-family: var(--font-serif);
  letter-spacing: .02em;
}

img { max-width: 100%; display: block; }

/* 图片加载失败兜底占位 */
.img-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  color: var(--ink-3); font-size: 13px; flex-direction: column; gap: 6px;
}
.img-fallback svg { width: 36px; height: 36px; opacity: .5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- 通用控件 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, color .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-ink));
  border-color: var(--brand); color: #fff;
  box-shadow: 0 2px 8px rgba(45, 106, 79, .25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-2), var(--brand)); border-color: var(--brand-2); box-shadow: 0 4px 16px rgba(45, 106, 79, .3); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.btn-soft:hover { background: #dcece6; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.field {
  min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(42, 138, 114, .16); }
textarea.field { resize: vertical; min-height: 40px; line-height: 1.5; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  background: var(--gold-soft); color: var(--ink-2);
  font-size: 12.5px; white-space: nowrap;
  border: 1px solid var(--line);
}
.tag-brand { background: var(--brand-soft); color: var(--brand-ink); border-color: rgba(45, 106, 79, .15); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 12px; margin: 0 8px 8px 0;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 13.5px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--brand-2); color: var(--brand-ink); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { font-size: 12px; opacity: .75; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 133, 90, .18); }
.dot.off { background: var(--accent); }

.spin {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 站点头部 ---------------- */

.site-head {
  position: sticky; top: 0; z-index: 40;
  height: var(--head-h);
  background: rgba(255, 253, 248, .92);
  backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(44, 36, 24, .06);
}
.site-head .wrap { height: 100%; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(150deg, var(--brand-2), var(--brand-ink));
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(45, 106, 79, .25);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { line-height: 1.15; }
.brand-text small { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }
.head-nav { display: flex; gap: 4px; margin-left: auto; }
.head-nav a {
  padding: 8px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: 14.5px;
}
.head-nav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.head-action { margin-left: 6px; }

/* ---------------- 首屏（中医风） ---------------- */

.hero {
  position: relative;
  padding: 52px 0 44px;
  background:
    radial-gradient(1000px 480px at 10% -15%, rgba(45, 106, 79, .10), transparent 65%),
    radial-gradient(800px 420px at 92% -5%, rgba(200, 151, 62, .10), transparent 70%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
/* 中医风装饰线条 */
.hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold), var(--accent), var(--brand));
  opacity: .6;
}
.hero-in { display: grid; gap: 22px; }
.eyebrow {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .12em;
  color: var(--brand-ink); text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before {
  content: '';
  width: 24px; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
  border-radius: 1px;
}
.hero h1 {
  margin: 0; max-width: 22ch;
  font-size: clamp(30px, 4.6vw, 48px); line-height: 1.18; letter-spacing: .01em;
  color: var(--brand-ink);
}
.hero .lead { margin: 0; max-width: 62ch; color: var(--ink-2); font-size: 16px; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.stats { display: flex; flex-wrap: wrap; gap: 10px 30px; }
.stat b {
  display: block; font-size: 28px; line-height: 1.2; letter-spacing: .01em;
  font-family: var(--font-serif); color: var(--brand-ink);
}
.stat span { color: var(--ink-3); font-size: 13px; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--line);
  background: var(--surface-2); border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13.5px;
}
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--brand); }

/* ---------------- 名录工具条 ---------------- */

main { padding: 34px 0 60px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
  position: relative;
}
.section-head::after {
  content: '';
  position: absolute; bottom: -2px; left: 0;
  width: 60px; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
}
.section-head h2 { margin: 0; font-size: 22px; color: var(--brand-ink); }
.section-head p { margin: 0; color: var(--ink-3); font-size: 13.5px; }

.toolbar {
  display: grid; gap: 12px;
  grid-template-columns: minmax(168px, 1.5fr) repeat(3, minmax(104px, .72fr)) auto;
  align-items: center;
  padding: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.search-box { position: relative; }
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}
.search-box .field { padding-left: 34px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 10px; gap: 2px; }
.seg button {
  min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-1); }

.chips-row { margin-top: 16px; }
.chips-row .chips { display: flex; flex-wrap: wrap; }
.chips-toggle { margin: 0 0 8px; }

.result-line { margin: 16px 0 14px; color: var(--ink-3); font-size: 13.5px; }
.result-line b { color: var(--ink); }

/* ---------------- 医生卡片 ---------------- */

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative;
}
/* 卡片顶部装饰线 */
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand-2), var(--gold), var(--brand-2));
  opacity: 0;
  transition: opacity .25s;
  z-index: 1;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.card:hover::before { opacity: .8; }
.card-media {
  position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.grid.avatar .card-media { aspect-ratio: 1 / 1; }
.grid.avatar .card-media img { object-position: center 28%; }
.card-kind {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 9px; border-radius: 999px;
  background: rgba(20, 26, 23, .72); color: #fff;
  font-size: 11.5px; font-weight: 600; backdrop-filter: blur(4px);
}
.card-kind.u { background: rgba(110, 84, 30, .78); }
.card-kind.g { background: rgba(120, 40, 34, .78); }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-name h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.card-name .alias { font-size: 12.5px; color: var(--ink-3); }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--ink-2); font-size: 13px; }
.card-meta .k { display: inline-flex; align-items: center; gap: 5px; }
.card-meta svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.card-specs { display: flex; flex-wrap: wrap; gap: 6px; }
.card-specs .tag { font-size: 12px; }
.card-sum {
  margin: 0; color: var(--ink-2); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.card-foot .btn { flex: 1; }

.empty {
  padding: 56px 20px; text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
}
.empty svg { width: 30px; height: 30px; margin-bottom: 10px; color: var(--line-strong); }

.more-row { display: flex; justify-content: center; margin-top: 22px; }

/* ---------------- 详情弹窗 ---------------- */

.modal {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 20px;
  background: rgba(24, 28, 26, .5);
  animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal-card {
  width: min(760px, 100%); max-height: min(86vh, 860px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-3);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6 } to { transform: none; opacity: 1 } }
.modal-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head .info { flex: 1; min-width: 0; }
.modal-head h3 { margin: 0 0 4px; font-size: 20px; }
.modal-head .sub { color: var(--ink-2); font-size: 13.5px; }
.icon-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.modal-body { overflow: auto; padding: 20px; }
.modal-foot {
  display: flex; gap: 10px; padding: 14px 20px; flex: none;
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.modal-foot .btn { flex: 1; }

.block { margin-bottom: 20px; }
.block:last-child { margin-bottom: 0; }
.block-title {
  margin: 0 0 9px; font-size: 12.5px; font-weight: 700; letter-spacing: .08em;
  color: var(--ink-3); text-transform: uppercase;
}
.kv { display: grid; gap: 8px; font-size: 14px; }
.kv > div { display: flex; gap: 10px; }
.kv dt { width: 76px; flex: none; color: var(--ink-3); }
.kv dd { margin: 0; }
.cover-lg { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-3); }

.vlist { display: grid; gap: 7px; }
.vlist a {
  display: flex; gap: 10px; align-items: baseline;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font-size: 13.5px;
}
.vlist a:hover { border-color: var(--brand-2); background: var(--brand-soft); text-decoration: none; }
.vlist .vd { color: var(--ink-3); font-size: 12.5px; flex: none; font-variant-numeric: tabular-nums; }
.vlist .vt { flex: 1; min-width: 0; }

/* ---------------- 咨询浮窗 ---------------- */

.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 50px; padding: 0 18px 0 15px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700;
  box-shadow: 0 10px 28px rgba(31, 111, 92, .38);
  transition: transform .16s, background .16s;
}
.fab:hover { transform: translateY(-2px); background: var(--brand-2); }
.fab svg { width: 20px; height: 20px; }
.fab .badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; text-align: center;
}

.consult {
  position: fixed; right: 22px; bottom: 22px; z-index: 65;
  width: min(396px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 44px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-3);
  animation: pop .18s ease-out;
}
.consult-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 13px 14px; background: linear-gradient(150deg, var(--brand), var(--brand-ink)); color: #fff;
}
.consult-head .t { font-weight: 700; }
.consult-head .s { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 6px; }
.consult-head .s .dot { background: rgba(255, 255, 255, .5); }
.consult-head .s .dot.on { background: #7ee2b8; box-shadow: none; }
.consult-head .s .dot.off { background: #ff9d92; }
.consult-head .grow { flex: 1; min-width: 0; }
.consult-head .icon-btn { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .22); color: #fff; }
.consult-head .icon-btn:hover { background: rgba(255, 255, 255, .28); color: #fff; }

.consult-tabs { display: flex; flex: none; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.consult-tabs button {
  flex: 1; min-height: 44px; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-2); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.consult-tabs button.on { color: var(--brand-ink); border-bottom-color: var(--brand); background: var(--surface); }
.consult-tabs .badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 11.5px;
  line-height: 18px; text-align: center; vertical-align: 1px;
}

/* 全局：被脚本用 el.hidden 收起的元素必须真正不参与布局，
   否则 display:flex/grid 的作者样式会覆盖 UA 的 [hidden] 规则 */
[hidden] { display: none !important; }

.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane[hidden] { display: none; }
.pane-scroll { flex: 1; min-height: 0; overflow: auto; }

.chat-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; font-size: 14.5px; }
.chat-head .who span { display: block; font-size: 12px; color: var(--ink-3); }

.msgs { flex: 1; min-height: 0; overflow: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.msgs .sys { text-align: center; color: var(--ink-3); font-size: 12.5px; }
.msg { display: flex; gap: 8px; max-width: 88%; }
.msg .av {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--ink-2);
}
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .av { background: var(--brand); color: #fff; }
.msg .bubble { min-width: 0; }
.msg .name { font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.msg.mine .name { text-align: right; }
.msg .txt {
  padding: 9px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word; font-size: 14.5px;
}
.msg.mine .txt { background: var(--brand); border-color: var(--brand); color: #fff; }
.msg .at { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.msg.mine .at { text-align: right; }
.msg.typing .txt { color: var(--ink-3); font-style: italic; }

.chat-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-foot .row { display: flex; gap: 9px; align-items: flex-end; }
.chat-foot textarea { max-height: 108px; min-height: 42px; }
.chat-foot .hint { margin: 6px 2px 0; font-size: 11.5px; color: var(--ink-3); }

.picker { padding: 14px; display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: 0; }
.picker .list { flex: 1; min-height: 0; overflow: auto; display: grid; gap: 8px; align-content: start; }
.pick-item {
  display: flex; gap: 10px; align-items: center; text-align: left; width: 100%;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
}
.pick-item:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.pick-item img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; object-position: center 28%; flex: none; background: var(--surface-3); }
.pick-item .pi { flex: 1; min-width: 0; }
.pick-item b { display: block; font-size: 14.5px; }
.pick-item span { display: block; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item .badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; flex: none;
  background: var(--accent); color: #fff; font-size: 11.5px; line-height: 20px; text-align: center;
}

/* ---------------- 页脚 ---------------- */

.site-foot {
  border-top: 2px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  padding: 28px 0; color: var(--ink-3); font-size: 13px;
  position: relative;
}
.site-foot::before {
  content: '';
  position: absolute; top: -2px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--gold), var(--accent), var(--brand));
  opacity: .5;
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.site-foot .grow { flex: 1; min-width: 200px; }

/* ---------------- 工作台 (admin.html) ---------------- */

.console { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }
.console-head {
  display: flex; align-items: center; gap: 12px; flex: none;
  height: var(--head-h); padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.console-head .grow { flex: 1; min-width: 0; }
.console-head .who { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.console-head .who b { color: var(--ink); }
/* 后台外壳：顶栏 + 左侧模块导航 + 主内容区，模块切换不整页刷新 */
.console-body { flex: 1; min-height: 0; display: flex; }

.module-nav {
  flex: none; width: 176px; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 10px; background: var(--surface); border-right: 1px solid var(--line);
  overflow: auto;
}
.module-nav .nav-title {
  margin: 0 0 6px; padding: 4px 8px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase;
}
.module-nav button {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: var(--ink-2); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s, color .15s;
}
.module-nav button svg { width: 17px; height: 17px; flex: none; }
.module-nav button:hover { background: var(--surface-3); color: var(--ink); }
.module-nav button.on { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand-ink); }
.module-nav button .badge {
  margin-left: auto; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11.5px; line-height: 19px; text-align: center;
}
.module-nav .nav-foot {
  margin-top: auto; padding: 10px 8px 2px; border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 11.5px; line-height: 1.55;
}

.module-host { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.module { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.conv-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }

/* ---------------- 医生管理模块 ---------------- */

.mg-top {
  flex: none; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 13px 18px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.mg-top .mg-title { flex: 1; min-width: 220px; }
.mg-top h2 { margin: 0 0 3px; font-size: 16.5px; }
.mg-top p { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.mg-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.mg-filters {
  flex: none; display: grid; gap: 10px;
  grid-template-columns: minmax(180px, 1.6fr) repeat(4, minmax(112px, .8fr));
  padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.mg-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; }
.mg-body.editing { grid-template-columns: 1fr minmax(340px, 400px); }
.mg-list { min-height: 0; overflow: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.mg-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.mg-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.mg-row.editing { border-color: var(--brand-2); background: var(--brand-soft); }
.mg-row img {
  width: 56px; height: 56px; border-radius: 10px; flex: none;
  object-fit: cover; object-position: center 28%; background: var(--surface-3);
}
.mg-info { min-width: 0; display: grid; gap: 5px; }
.mg-info .n { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mg-info .n b { font-size: 15px; }
.mg-info .n code { font-size: 11.5px; color: var(--ink-3); background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.mg-info .m { display: flex; gap: 5px 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; }
.mg-info .s { display: flex; gap: 5px; flex-wrap: wrap; }
.mg-info .s .tag { font-size: 11.5px; }
.mg-empty { padding: 42px 16px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

.mg-editor {
  min-height: 0; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--surface);
}
.mg-ed-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mg-ed-head h3 { flex: 1; margin: 0; font-size: 15px; }
.mg-form { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; display: grid; gap: 12px; align-content: start; }
.mg-form .grp { display: grid; gap: 6px; }
.mg-form label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.mg-form .req { color: var(--accent); font-weight: 500; }
.mg-form .grid2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.mg-form .hint-inline { color: var(--ink-3); font-size: 11.5px; font-weight: 400; }
.mg-form .hint-inline code { font-size: 11.5px; }
.mg-form .check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.mg-form .check input { width: 16px; height: 16px; flex: none; }
.mg-img-row { display: grid; grid-template-columns: 1fr 64px; gap: 8px; align-items: center; }
.mg-img-prev { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; object-position: center 28%; background: var(--surface-3); }
.mg-form-err { min-height: 16px; color: var(--accent); font-size: 12.5px; }
.mg-form-foot { display: flex; gap: 10px; }
.mg-form-foot .btn { flex: 1; }

/* ---------------- 账号管理模块 ---------------- */

.ac-filters { grid-template-columns: minmax(220px, 2.2fr) minmax(120px, 1fr); }
.ac-av {
  width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center;
  font-size: 16px; font-weight: 800; color: #fff; flex: none; letter-spacing: .02em;
  background: var(--brand);
}
.ac-av.role-admin { background: linear-gradient(135deg, #1f6f5c, #14503f); }
.ac-av.role-agent { background: linear-gradient(135deg, #2a8a72, #1f6f5c); }
.ac-av.role-doctor { background: linear-gradient(135deg, #4c74ad, #27507f); }

.ac-sec {
  flex: none; padding: 12px 18px; background: var(--brand-soft);
  border-bottom: 1px solid var(--line); display: grid; gap: 10px;
}
.ac-sec-head h3 { margin: 0 0 2px; font-size: 14px; }
.ac-sec-head p { margin: 0; color: var(--ink-2); font-size: 12.5px; }
.ac-sec-head code, .ac-sec-msg code { font-size: 11.5px; }
.ac-sec-grid { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.ac-sec-grid .grp { display: grid; gap: 6px; }
.ac-sec-grid label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ac-sec-grid .field { min-height: 36px; }
.ac-sec-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ac-sec-msg { color: var(--brand-ink); font-size: 12.5px; }

@media (max-width: 860px) {
  .ac-sec-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .ac-filters { grid-template-columns: 1fr; }
  .ac-sec-grid { grid-template-columns: 1fr; }
  .mg-row .ac-av { width: 44px; height: 44px; border-radius: 11px; font-size: 15px; }
}

.side {
  min-height: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--surface);
}
.side-top { flex: none; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.side-filters { display: flex; gap: 6px; }
.side-filters button {
  flex: 1; min-height: 34px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.side-filters button.on { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand-ink); }
.side-filters .n { opacity: .7; font-weight: 500; }
.conv-list { flex: 1; min-height: 0; overflow: auto; }
.conv-item {
  display: grid; gap: 5px; width: 100%; text-align: left;
  padding: 11px 13px; border: 0; border-bottom: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.conv-item .r1 { display: flex; align-items: center; gap: 8px; }
.conv-item .r1 b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.conv-item .r1 .tm { color: var(--ink-3); font-size: 11.5px; flex: none; }
.conv-item .r2 { display: flex; align-items: center; gap: 6px; }
.conv-item .r2 .last {
  flex: 1; min-width: 0; color: var(--ink-3); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-item .r2 .badge {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; flex: none;
  background: var(--accent); color: #fff; font-size: 11.5px; line-height: 19px; text-align: center;
}
.conv-item .r2 .tag { font-size: 11.5px; padding: 1px 7px; }
.side-foot {
  flex: none; padding: 10px 12px; border-top: 1px solid var(--line);
  background: var(--surface-2); font-size: 12.5px; color: var(--ink-3);
}
.side-foot .presence { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.thread { min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.thread-head {
  flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.thread-head .grow { flex: 1; min-width: 180px; }
.thread-head h2 { margin: 0 0 3px; font-size: 16.5px; }
.thread-head .sub { color: var(--ink-3); font-size: 12.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread-head .acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thread-head select { min-height: 34px; padding: 0 10px; }

.blank {
  flex: 1; display: grid; place-items: center; text-align: center; color: var(--ink-3);
  padding: 40px 20px;
}
.blank svg { width: 34px; height: 34px; margin-bottom: 12px; color: var(--line-strong); }

.login {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  padding: 20px; background: rgba(24, 28, 26, .5);
}
.login-card {
  width: min(430px, 100%); background: var(--surface); border-radius: 18px;
  padding: 26px; box-shadow: var(--shadow-3); display: grid; gap: 16px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.login-card .grp { display: grid; gap: 7px; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.role-seg { display: flex; gap: 8px; }
.role-seg button {
  flex: 1; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink-2); font-weight: 600; cursor: pointer;
}
.role-seg button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.login-err { color: var(--accent); font-size: 13px; min-height: 18px; }
.login-hint { color: var(--ink-3); font-size: 12.5px; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .module-nav {
    width: 100%; flex-direction: row; gap: 6px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px;
  }
  .module-nav .nav-title, .module-nav .nav-foot { display: none; }
  .module-nav button { width: auto; flex: none; }
  .conv-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 42vh; }
  .mg-body { grid-template-columns: 1fr; }
  .mg-body.editing { grid-template-columns: 1fr; }
  .mg-editor { border-left: 0; border-top: 1px solid var(--line); max-height: 62vh; }
  .mg-filters { grid-template-columns: 1fr 1fr; }
  .mg-filters .search-box { grid-column: 1 / -1; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search-box { grid-column: 1 / -1; }
  .toolbar .seg { justify-self: start; }
}

@media (max-width: 620px) {
  .wrap { padding: 0 14px; }
  .module-nav { padding: 8px 10px; }
  .module-nav button { padding: 0 9px; font-size: 13px; }
  .mg-top, .mg-filters, .mg-list { padding-left: 14px; padding-right: 14px; }
  .mg-filters { grid-template-columns: 1fr; }
  .mg-row { grid-template-columns: 46px minmax(0, 1fr); }
  .mg-row img { width: 46px; height: 46px; }
  .mg-row .mg-row-act { grid-column: 2; justify-self: start; }
  .mg-form .grid2 { grid-template-columns: 1fr; }
  .hero { padding: 30px 0 26px; }
  .head-nav { display: none; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; padding: 12px; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; height: 100vh; border-radius: 0; width: 100%; }
  .consult {
    right: 0; bottom: 0; width: 100vw; height: 100vh; border-radius: 0; border: 0;
  }
  .fab { right: 14px; bottom: 14px; padding: 0 16px 0 13px; }
  .stat b { font-size: 22px; }
  /* 手机端触控优化 */
  .btn, .card-foot .btn, .name-btn, .seg-cap, .role-seg button, .side-filters button {
    min-height: 44px;
  }
  .chips .tag, .card-specs .tag { min-height: 32px; padding: 6px 12px; }
  .card-body { padding: 12px; gap: 8px; }
  .card-name h3 { font-size: 16px; }
  .toolbar .field, .ac-filters .field, .side-top .field { min-height: 42px; font-size: 16px; }
  /* 咨询面板适配安全区 */
  .consult {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .thread-head { padding: 10px 14px; }
  .thread-head h2 { font-size: 15px; }
  /* 详情弹窗内边距 */
  .modal-body { padding: 14px; }
  .modal-head { padding: 14px; }
  /* 顶部导航栏小屏 */
  .site-head { padding: 0 14px; }
  .brand-text { font-size: 14px; }
  .brand-text small { display: none; }
  /* 统计条目 */
  .stats { gap: 8px 18px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 12px; }
  /* 表单控件加大便于触控 */
  .field, select.field, textarea.field { font-size: 16px; }
  /* FAB 按钮适配 iPhone 底部横条 */
  .fab { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

/* 超小屏（iPhone SE 等 375px） */
@media (max-width: 380px) {
  .wrap { padding: 0 10px; }
  .hero h1 { font-size: 22px; }
  .cta-main { min-height: 56px; padding: 8px 20px 8px 16px; }
  .cta-main .cta-text { font-size: 16px; }
  .card-media { aspect-ratio: 4 / 3; }
  .fab { min-height: 50px; padding: 0 14px 0 12px; font-size: 14px; }
}

/* 横屏手机 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding: 16px 0 12px; }
  .hero h1 { font-size: 22px; }
  .fab { min-height: 48px; }
  .consult { height: 100vh; }
}

/* 触控设备加大点击区 */
@media (hover: none) and (pointer: coarse) {
  .btn, button, .tag, .conv-item, .pick-item, .mg-row {
    min-height: 44px;
  }
  .conv-item { padding: 13px 14px; }
  a { padding: 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}