/* ============================================================
   在线问诊平台 · 主题样式（医疗蓝 · 简洁专业）
   对应论文：4.1 系统总体架构设计 / 5.x 系统实现
   ============================================================ */

:root {
  --primary: #1a6fd4;
  --primary-dark: #14559e;
  --primary-light: #e8f1fc;
  --primary-soft: #f4f8fe;
  --teal: #0fa3a3;
  --success: #17a673;
  --warning: #e8992a;
  --danger: #e05252;
  --text-1: #17263b;
  --text-2: #4a5c72;
  --text-3: #8698ad;
  --border: #e2e9f2;
  --border-strong: #ccd8e6;
  --bg: #f5f8fc;
  --card: #ffffff;
  --shadow-sm: 0 1px 3px rgba(23, 38, 59, .06);
  --shadow: 0 4px 16px rgba(23, 38, 59, .08);
  --shadow-lg: 0 12px 32px rgba(23, 38, 59, .12);
  --radius: 10px;
  --radius-sm: 6px;
  --header-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- 布局 ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: var(--text-1); }
.brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: #fff; display: grid; place-items: center; font-size: 17px;
}
.brand small { font-weight: 400; font-size: 12px; color: var(--text-3); margin-left: 4px; }

.topnav { display: flex; gap: 4px; margin-left: 40px; flex: 1; }
.topnav a {
  padding: 7px 14px; border-radius: var(--radius-sm); color: var(--text-2);
  font-size: 14px; transition: all .16s;
}
.topnav a:hover { background: var(--primary-light); color: var(--primary); }
.topnav a.active { background: var(--primary); color: #fff; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px; border-radius: 20px; background: var(--primary-soft);
  border: 1px solid var(--border);
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-chip .meta { line-height: 1.2; }
.user-chip .meta b { display: block; font-size: 13px; }
.user-chip .meta i { font-style: normal; font-size: 11px; color: var(--text-3); }

.main-wrap { flex: 1; display: flex; }
.sidebar {
  width: 210px; background: #fff; border-right: 1px solid var(--border);
  padding: 16px 12px; flex-shrink: 0;
}
.sidebar .group-title {
  font-size: 11px; color: var(--text-3); letter-spacing: 1px;
  padding: 10px 12px 6px; font-weight: 600;
}
.sidebar a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13.5px; margin-bottom: 2px; transition: all .15s;
}
.sidebar a:hover { background: var(--primary-soft); color: var(--primary); }
.sidebar a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.sidebar a .ico { width: 16px; text-align: center; opacity: .9; }

.content { flex: 1; padding: 22px 26px 40px; min-width: 0; }
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-head p { color: var(--text-3); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h3::before {
  content: ''; width: 3px; height: 15px; background: var(--primary); border-radius: 2px;
}

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topnav { display: none; }
}

/* ---------- 统计卡 ---------- */
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.stat .ic {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  font-size: 20px; background: var(--primary-light); color: var(--primary); flex-shrink: 0;
}
.stat .val { font-size: 24px; font-weight: 700; line-height: 1.15; }
.stat .lbl { font-size: 12.5px; color: var(--text-3); }
.stat.green .ic { background: #e6f7f1; color: var(--success); }
.stat.orange .ic { background: #fdf3e4; color: var(--warning); }
.stat.red .ic { background: #fdeaea; color: var(--danger); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: #fff; color: var(--text-2); font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.93); color: #fff; }
.btn-danger { background: #fff; border-color: #f0c2c2; color: var(--danger); }
.btn-danger:hover { background: #fdeaea; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-lg { padding: 11px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-link { border: none; background: none; color: var(--primary); padding: 2px 4px; cursor: pointer; font-size: 13px; font-family: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit;
  background: #fff; color: var(--text-1); transition: all .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,111,212,.1);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.form-error { font-size: 12.5px; color: var(--danger); margin-top: 5px; min-height: 17px; }

.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-group label {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13.5px; color: var(--text-2); transition: all .15s; margin: 0;
}
.radio-group input { accent-color: var(--primary); }
.radio-group label:has(input:checked) {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600;
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  background: #f7fafd; color: var(--text-2); font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 13px;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-1); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--primary-soft); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500; line-height: 1.7; white-space: nowrap;
}
.tag-blue { background: var(--primary-light); color: var(--primary-dark); }
.tag-green { background: #e6f7f1; color: #0d7d56; }
.tag-orange { background: #fdf3e4; color: #b5741a; }
.tag-red { background: #fdeaea; color: #c03a3a; }
.tag-gray { background: #eef2f7; color: var(--text-2); }

/* ---------- 空状态 / 提示 ---------- */
.empty {
  text-align: center; padding: 46px 20px; color: var(--text-3); font-size: 13.5px;
}
.empty .big { font-size: 38px; display: block; margin-bottom: 10px; opacity: .45; }

.notice-bar {
  background: linear-gradient(90deg, var(--primary-light), #f2f8ff);
  border: 1px solid #d6e6fa; border-radius: var(--radius); padding: 11px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 16px;
}
.notice-bar .ic { color: var(--primary); font-size: 15px; }
.notice-bar b { color: var(--primary-dark); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(23,38,59,.45);
  display: grid; place-items: center; z-index: 999; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-head .close {
  border: none; background: none; font-size: 21px; cursor: pointer;
  color: var(--text-3); line-height: 1; padding: 0 4px;
}
.modal-head .close:hover { color: var(--danger); }
.modal-body { padding: 20px 22px; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff;
}
.modal.wide { max-width: 720px; }

/* ---------- 提示条 ---------- */
.toast-wrap { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 20px; border-radius: 8px; background: #fff; box-shadow: var(--shadow-lg);
  font-size: 13.5px; display: flex; align-items: center; gap: 8px; border-left: 3px solid var(--primary);
  animation: slideDown .2s ease-out; max-width: 90vw;
}
@keyframes slideDown { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.ok { border-left-color: var(--success); }
.toast.ok .ic { color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.err .ic { color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast.warn .ic { color: var(--warning); }
.toast .ic { font-size: 15px; }

/* ---------- 医生卡片 ---------- */
.doc-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 14px; transition: all .18s; box-shadow: var(--shadow-sm);
}
.doc-card:hover { border-color: #b9d3f0; box-shadow: var(--shadow); transform: translateY(-2px); }
.doc-avatar {
  width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), #d9e9fb); color: var(--primary-dark);
}
.doc-info { flex: 1; min-width: 0; }
.doc-info .name { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.doc-info .tit { font-size: 12.5px; color: var(--text-3); margin-bottom: 5px; }
.doc-info .intro {
  font-size: 12.5px; color: var(--text-2); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.doc-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); margin-top: 7px; flex-wrap: wrap; }
.doc-meta span { display: flex; align-items: center; gap: 3px; }

/* ---------- 科室卡片 ---------- */
.dept-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: all .18s; box-shadow: var(--shadow-sm);
}
.dept-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.dept-card .dh { display: flex; align-items: center; gap: 11px; margin-bottom: 9px; }
.dept-card .dic {
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary-light);
  color: var(--primary); display: grid; place-items: center; font-size: 19px;
}
.dept-card .dn { font-size: 15px; font-weight: 700; }
.dept-card .dc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; min-height: 40px; }
.dept-card .df { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; }

/* ---------- 聊天（图文问诊） ---------- */
.chat-box {
  background: #f7fafd; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; max-height: 420px; overflow-y: auto;
}
.chat-item { margin-bottom: 16px; display: flex; gap: 10px; }
.chat-item .cav {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
}
.chat-item.patient .cav { background: var(--teal); }
.chat-item.doctor .cav { background: var(--primary); }
.chat-item .bubble {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; line-height: 1.7; max-width: 76%;
  white-space: pre-wrap; word-break: break-word;
}
.chat-item .who { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.chat-item .tm { font-size: 11px; color: var(--text-3); margin-top: 5px; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eaf3fe 0%, #f5f8fc 45%, #e8f6f6 100%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 940px; background: #fff; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(23,38,59,.13); display: flex; overflow: hidden; min-height: 540px;
}
.auth-left {
  flex: 1.05; background: linear-gradient(150deg, #1a6fd4, #0f8ab0 60%, #0fa3a3);
  color: #fff; padding: 44px 40px; display: flex; flex-direction: column;
}
.auth-left .lg { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 30px; }
.auth-left .lg .logo {
  width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.22);
  display: grid; place-items: center; font-size: 19px;
}
.auth-left h1 { font-size: 25px; line-height: 1.45; font-weight: 700; margin-bottom: 14px; }
.auth-left h1 span { color: #b9e8ff; }
.auth-left .desc { font-size: 13.5px; opacity: .9; line-height: 1.85; margin-bottom: 26px; }
.auth-feats { margin-top: auto; display: grid; gap: 12px; }
.auth-feats .f { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.auth-feats .f i {
  width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-style: normal; font-size: 14px; flex-shrink: 0;
}
.auth-right { flex: 1; padding: 44px 42px; display: flex; flex-direction: column; }
.auth-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.auth-tabs button {
  border: none; background: none; padding: 0 0 12px; font-size: 15.5px; cursor: pointer;
  color: var(--text-3); font-family: inherit; position: relative; font-weight: 500;
}
.auth-tabs button.on { color: var(--primary); font-weight: 700; }
.auth-tabs button.on::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2.5px;
  background: var(--primary); border-radius: 2px;
}
.auth-right form { flex: 1; display: flex; flex-direction: column; }
.auth-submit { margin-top: 6px; }
.quick-login { margin-top: auto; padding-top: 20px; border-top: 1px dashed var(--border); }
.quick-login .qt { font-size: 12px; color: var(--text-3); margin-bottom: 9px; }
.quick-login .qs { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 820px) {
  .auth-left { display: none; }
  .auth-card { max-width: 460px; min-height: auto; }
  .auth-right { padding: 32px 26px; }
}

/* ---------- 其他 ---------- */
.detail-list { display: grid; gap: 0; }
.detail-list .row { display: flex; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.detail-list .row:last-child { border-bottom: none; }
.detail-list .row .k { width: 110px; color: var(--text-3); flex-shrink: 0; }
.detail-list .row .v { flex: 1; color: var(--text-1); word-break: break-word; }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.slot {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 11px 8px; text-align: center; cursor: pointer; transition: all .15s; background: #fff;
}
.slot:hover:not(.disabled) { border-color: var(--primary); background: var(--primary-soft); }
.slot.on { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 2px rgba(26,111,212,.13); }
.slot.disabled { opacity: .45; cursor: not-allowed; background: #f7f9fc; }
.slot .p { font-weight: 600; font-size: 13.5px; }
.slot .s { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.slot.on .s { color: var(--primary-dark); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 5px 14px; border-radius: 20px; border: 1px solid var(--border-strong);
  font-size: 13px; cursor: pointer; color: var(--text-2); background: #fff; transition: all .15s;
}
.pill:hover { border-color: var(--primary); color: var(--primary); }
.pill.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.progress { height: 6px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--teal)); border-radius: 4px; transition: width .4s; }

.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 160px; }
.mb0 { margin-bottom: 0 !important; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.text-c { text-align: center; }
.text-r { text-align: right; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
