/* 佑联会员中心 · 公共设计系统(纯前端表现层) 2026-07-16
   供 staff.html / doctor.html / ownership.html 共用;index.html 用 style.css(调色板与此一致)。
   页面特调放各页 <style>(在本文件之后加载,同优先级时后者覆盖)。
   类名契约不改:JS 依赖 .tab.on / .chip.on / tr.over / tr.hot / .st st-* / .modal-bg.on 等。 */

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --faint: #94a3b8;
  --line: #e5e9f0;
  --primary: #0e7490;
  --primary-deep: #155e75;
  --primary-soft: #e0f2fe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --brand-grad: linear-gradient(100deg, #0e7490, #155e75);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}

/* —— 顶栏 —— */
.top { background: var(--brand-grad); color: #fff; padding: 13px 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: var(--shadow); }
.top h1 { font-size: 17px; font-weight: 600; letter-spacing: .3px; }
.top h1 small { font-weight: normal; opacity: .72; font-size: 12px; margin-left: 8px; }
.top .sw { font-size: 12px; opacity: .85; margin-right: 8px; }
.top select { padding: 6px 10px; border-radius: 8px; border: none; font-size: 13px; color: var(--ink); }
.top a { color: #fff; font-size: 12px; margin-left: 8px; text-decoration: none; background: rgba(255,255,255,.14); padding: 4px 11px; border-radius: 20px; white-space: nowrap; }
.top a:hover { background: rgba(255,255,255,.26); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 22px 50px; }
.databar { background: var(--amber-soft); border: 1px solid #f0d77b; color: #8a6d1a; padding: 8px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.databar.danger { background: var(--red-soft); border-color: #f3c1c1; color: var(--red); }
.redline { font-size: 12px; color: var(--amber); background: #fff9ef; border: 1px solid #ffe4b8; border-radius: 8px; padding: 7px 12px; margin: 8px 0 14px; }

/* —— 基础白卡 + KPI 统计卡(KPI 特性只在 .cards 网格内生效,不污染普通容器卡) —— */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.cards .card { position: relative; overflow: hidden; }
.cards .card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: .9; }
.cards .card:has(.num.warn)::before { background: var(--red); }
.cards .card .lbl { color: var(--muted); font-size: 12px; }
.cards .card .num { font-size: 25px; font-weight: 700; color: var(--ink); margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.cards .card .num.warn { color: var(--red); }
.cards .card .sub { font-size: 12px; color: var(--faint); }

/* —— Tab(选中页签与面板连体) —— */
.tabs { display: flex; gap: 4px; margin-bottom: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-block; padding: 10px 18px; cursor: pointer; font-size: 13px; color: var(--muted); border-radius: 10px 10px 0 0; white-space: nowrap; user-select: none; }
.tab:hover { color: var(--ink); background: rgba(255,255,255,.65); }
.tab.on { background: #fff; color: var(--primary); font-weight: 600; }
.panel { background: #fff; border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }

/* —— 表格 —— */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #f0f3f7; vertical-align: top; font-size: 13px; }
tbody tr:not(.over):not(.hot):hover td { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* 逾期/临期分级:hot=临期(黄) over=逾期(浅红) over.sev=重度逾期(深红,如逾期>90天) */
tr.hot td { background: #fffaf0; }
tr.hot td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
tr.over td { background: #fdf4f2; }
tr.over td:first-child { box-shadow: inset 3px 0 0 #e5989b; }
tr.over.sev td { background: #fbebe9; }
tr.over.sev td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* —— 状态徽章(.st=工作台 / .b=归属看板,同一套视觉) —— */
.st, .b { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; white-space: nowrap; line-height: 1.5; }
.st-gray, .b-gray { background: #eef1f5; color: #5d6d7e; }
.st-blue, .b-blue { background: var(--primary-soft); color: var(--primary); }
.st-amber, .b-amber { background: var(--amber-soft); color: var(--amber); }
.st-green, .b-green { background: var(--green-soft); color: var(--green); }
.st-red, .b-red { background: var(--red-soft); color: var(--red); }

/* —— 按钮 —— */
.btn { display: inline-block; padding: 5px 13px; border-radius: 7px; border: 1px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; font-size: 12px; margin: 2px 4px 2px 0; white-space: nowrap; text-decoration: none; transition: background .12s; }
.btn:hover { background: var(--primary-deep); }
.btn.ghost { background: #fff; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.s { background: #eef1f5; border-color: #eef1f5; color: #334155; }
.btn.s:hover { background: #e2e8f0; }

.plink { color: var(--primary); cursor: pointer; border-bottom: 1px dashed #7cb8c4; font-weight: 600; }
.plink:hover { color: var(--primary-deep); }
.note { font-size: 12px; color: var(--faint); margin-top: 10px; line-height: 1.7; }
.empty { padding: 30px; text-align: center; color: var(--faint); font-size: 13px; }
.muted { color: var(--muted); }

/* —— 弹窗 —— */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(20,40,60,.45); z-index: 50; }
.modal-bg.on { display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: 680px; max-width: 95%; padding: 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal h2 { font-size: 17px; color: var(--primary-deep); margin-bottom: 4px; }
.modal .close { float: right; cursor: pointer; font-size: 20px; color: var(--faint); }
.sec-t { font-size: 13px; color: var(--primary); font-weight: bold; margin: 16px 0 8px; border-left: 3px solid var(--primary); padding-left: 8px; }
.timeline li { list-style: none; padding: 7px 0 7px 16px; border-left: 2px solid #dde5ec; font-size: 13px; color: #5d6d7e; margin-left: 6px; line-height: 1.7; }
.timeline li b { color: var(--ink); font-weight: bold; }

/* —— 搜索/分页 —— */
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.searchbar input { padding: 7px 12px; border: 1px solid #dde5ec; border-radius: 8px; font-size: 13px; width: 280px; }
.pager { margin-top: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; }

/* —— staff 工作台特有 —— */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: #fff; }
.pcard.danger { border-color: #eac3bf; background: #fefaf9; }
.pcard.warn { border-color: #ecd9a8; background: #fffdf6; }
.pcard .hd { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.pcard .meta { font-size: 12px; color: var(--faint); margin-left: 8px; font-weight: normal; }
.pcard .row { font-size: 13px; color: #5d6d7e; padding: 3px 0; line-height: 1.6; }
.pcard .row b { color: var(--ink); font-weight: normal; }
.pcard .lab { color: var(--primary-deep); font-size: 12px; }
.srcbadge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: var(--primary-soft); color: var(--primary); margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.srcbadge.mine { background: var(--green-soft); color: var(--green); }
.sticky-box { background: #f4f8fa; border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 12px; color: #5d6d7e; line-height: 1.9; }
.sticky-box b { color: var(--ink); font-weight: normal; }
.script-box { background: #f0f7f9; border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 8px 12px; font-size: 12px; color: #3d4854; line-height: 1.8; margin-top: 6px; }
.care-tpl { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.care-tpl.on { border-color: var(--primary); background: #f0f7f9; }
.care-tpl .sc { font-size: 12px; color: var(--primary); font-weight: bold; margin-bottom: 3px; }
.countbox { background: #f0f7f9; border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; }
.countbox .big { font-size: 26px; font-weight: bold; color: var(--primary-deep); }
.countbox.overdue .big { color: var(--red); }
.countbox .meta { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); }
.field textarea, .field input[type=date], .field select { width: 100%; padding: 8px 10px; border: 1px solid #dde5ec; border-radius: 8px; font-size: 13px; margin-top: 6px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { padding: 5px 12px; border: 1px solid #dde5ec; border-radius: 16px; font-size: 12px; cursor: pointer; background: #fff; color: #5d6d7e; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 13px; z-index: 99; box-shadow: 0 4px 14px rgba(0,0,0,.25); }

/* 会员黑名单：醒目提示，但不覆盖或阻断任何正常医疗服务操作。 */
.blacklist-alert { background: #7f1d1d; color: #fff; border-radius: 8px; padding: 11px 14px; margin: 10px 0; line-height: 1.7; }
.blacklist-alert b, .blacklist-pending b { font-size: 14px; }
.blacklist-alert small, .blacklist-pending small { display: block; font-size: 12px; margin-top: 2px; }
.blacklist-alert small { color: #fee2e2; }
.blacklist-pending { background: var(--amber-soft); color: #8a6d1a; border: 1px solid #ecd9a8; border-radius: 8px; padding: 10px 13px; margin: 10px 0; line-height: 1.7; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #991b1b; border-color: #991b1b; }

/* —— 建议话术:默认折叠,点开可复制(降噪) —— */
details.script-fold { background: #f0f7f9; border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0; padding: 6px 12px; margin-top: 6px; font-size: 12px; color: #3d4854; }
details.script-fold summary { cursor: pointer; color: var(--primary); font-weight: 500; user-select: none; list-style: none; display: flex; align-items: center; gap: 8px; }
details.script-fold summary::-webkit-details-marker { display: none; }
details.script-fold summary::before { content: '▸'; transition: transform .15s; }
details.script-fold[open] summary::before { transform: rotate(90deg); }
details.script-fold .sf-body { padding: 6px 0 2px; line-height: 1.8; }
.copybtn { padding: 1px 10px; border-radius: 12px; border: 1px solid var(--primary); background: #fff; color: var(--primary); font-size: 11px; cursor: pointer; }
.copybtn:hover { background: var(--primary-soft); }

/* —— doctor 工作台特有 —— */
.doccard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.doccard .nm { font-size: 18px; color: var(--primary-deep); font-weight: bold; }
.doccard .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.codebox { text-align: center; background: var(--primary-soft); border-radius: 10px; padding: 8px 18px; }
.codebox b { color: var(--primary-deep); letter-spacing: 2px; font-size: 15px; }
.codebox div { font-size: 11px; color: var(--muted); margin-top: 2px; }
.diag b { color: var(--ink); font-weight: normal; }
.diag small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; }
.sms-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.sms-item .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sms-item .body { background: #f4f8fa; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #3d4854; line-height: 1.7; }

/* —— 微交互(第二轮打磨):focus 光圈 / hover 反馈 / 进入动画 —— */
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(14,116,144,.13); }
.btn:active { transform: translateY(1px); }
.pcard { transition: box-shadow .15s; }
.pcard:hover { box-shadow: var(--shadow); }
.tab { transition: color .12s, background .12s; }
.modal { animation: modal-in .18s ease; }
@keyframes modal-in { from { transform: translateY(14px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }
.toast { animation: toast-in .2s ease; }
@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
details.script-fold .sf-body { animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.timeline li { position: relative; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px #fff; }
/* 长列表滚动条细化(Chromium 系) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* —— 加载骨架屏 —— */
.skel { padding: 4px 0; }
.skel .sk { height: 13px; border-radius: 6px; margin: 14px 0; background: linear-gradient(90deg, #edf1f5 25%, #f8fafc 40%, #edf1f5 55%); background-size: 600% 100%; animation: skel-wave 1.1s infinite linear; }
@keyframes skel-wave { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* —— 响应式:平板/手机 —— */
@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .pgrid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 12px 12px 40px; }
  .top { padding: 10px 14px; }
  .top h1 { font-size: 15px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card .num { font-size: 21px; }
  .panel { padding: 12px; border-radius: 0 10px 10px 10px; }
  /* 普通宽表:横向滚动保底 */
  .panel table:not(.rwd) { display: block; overflow-x: auto; }
  /* .rwd 表(重点列表):转卡片,td 用 data-th 显示列名 */
  table.rwd thead { display: none; }
  table.rwd, table.rwd tbody, table.rwd tr, table.rwd td { display: block; width: 100%; }
  table.rwd tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px 12px; background: #fff; }
  table.rwd tr.hot, table.rwd tr.over { border-left-width: 3px; }
  table.rwd tr.hot { border-left-color: var(--amber); }
  table.rwd tr.over { border-left-color: var(--red); }
  table.rwd tr.hot td:first-child, table.rwd tr.over td:first-child, table.rwd tr.over.sev td:first-child { box-shadow: none; }
  table.rwd td { border: none; padding: 3px 0; }
  table.rwd td[data-th]::before { content: attr(data-th); display: block; font-size: 11px; color: var(--faint); margin-bottom: 1px; }
  .searchbar input { width: 100%; }
  /* 弹窗贴边,内边距收窄 */
  .modal-bg.on { padding: 16px 10px; }
  .modal { padding: 16px 14px; }
  .doccard { padding: 12px 14px; }
  .codebox { flex: 1; }
}
