/* ============================================================
   魏县医养结合健康管理系统 · 通用样式
   ============================================================ */

:root {
  --ehs-primary: #1677c9;
  --ehs-primary-dark: #10599b;
  --ehs-accent: #0fb9b1;
  --ehs-bg: #f2f5f9;
  --ehs-card: #ffffff;
  --ehs-text: #1f2d3d;
  --ehs-text-sub: #6b7c93;
  --ehs-border: #e2e8f0;
  --ehs-danger: #e34d59;
  --ehs-warn: #ed7b2f;
  --ehs-ok: #00a870;
  --ehs-radius: 10px;
  --ehs-shadow: 0 2px 12px rgba(16, 89, 155, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ehs-bg);
  color: var(--ehs-text);
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

#app { height: 100%; }

/* ---------------------------------------------------------- 登录页 */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(130deg, #0f3f70 0%, #1677c9 45%, #0fb9b1 100%);
  position: relative;
  overflow: hidden;
}
.login-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.55;
}
.login-box {
  width: 940px;
  max-width: 94vw;
  min-height: 500px;
  display: flex;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(4, 32, 61, 0.35);
  position: relative;
  z-index: 2;
}
.login-left {
  flex: 1.1;
  background: linear-gradient(160deg, #10599b, #1677c9 60%, #0fb9b1);
  color: #fff;
  padding: 46px 40px;
  display: flex;
  flex-direction: column;
}
.login-left h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: 1px; }
.login-left .sub { opacity: 0.85; font-size: 13px; line-height: 1.9; }
.login-left ul { margin: 26px 0 0; padding-left: 18px; font-size: 13px; line-height: 2.1; opacity: 0.94; }
.login-left .foot { margin-top: auto; font-size: 12px; opacity: 0.75; }
.login-right { flex: 1; padding: 52px 44px; display: flex; flex-direction: column; justify-content: center; }
.login-right h2 { margin: 0 0 6px; font-size: 22px; color: var(--ehs-text); }
.login-right .hint { color: var(--ehs-text-sub); font-size: 13px; margin-bottom: 26px; }
.demo-accounts { margin-top: 22px; border-top: 1px dashed var(--ehs-border); padding-top: 16px; }
.demo-accounts .title { font-size: 12px; color: var(--ehs-text-sub); margin-bottom: 8px; }
.demo-accounts .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-accounts .chip {
  border: 1px solid var(--ehs-border);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--ehs-text-sub);
  cursor: pointer;
  transition: all 0.18s;
  background: #fbfdff;
}
.demo-accounts .chip:hover { border-color: var(--ehs-primary); color: var(--ehs-primary); background: #f0f7ff; }

/* ---------------------------------------------------------- 主框架 */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 218px;
  background: linear-gradient(180deg, #0f3f70, #10599b);
  color: #e6f0fa;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  letter-spacing: 0.5px;
}
.logo .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #0fb9b1, #47d1c9);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #04384f; font-weight: 700;
}
.menu { flex: 1; padding: 12px 10px; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
  color: #cfe3f5; transition: all 0.16s;
  border-left: 3px solid transparent;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.menu-item.active { background: rgba(15, 185, 177, 0.22); color: #fff; border-left-color: #0fb9b1; font-weight: 600; }
.sidebar-foot { padding: 12px 16px; font-size: 11px; color: rgba(255, 255, 255, 0.45); border-top: 1px solid rgba(255,255,255,0.08); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--ehs-border);
  display: flex; align-items: center; padding: 0 22px; gap: 16px; flex-shrink: 0;
}
.topbar .title { font-size: 17px; font-weight: 600; }
.topbar .crumb { color: var(--ehs-text-sub); font-size: 13px; }
.topbar .spacer { flex: 1; }
.topbar .org-tag { color: var(--ehs-text-sub); font-size: 13px; }
.content { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

/* ---------------------------------------------------------- 卡片 / 统计 */
.card {
  background: var(--ehs-card); border-radius: var(--ehs-radius);
  box-shadow: var(--ehs-shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card > h3 {
  margin: 0 0 14px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card > h3::before {
  content: ""; width: 3px; height: 15px; border-radius: 2px;
  background: var(--ehs-primary);
}
.card-head { display: flex; align-items: center; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head h3::before { content: ""; width: 3px; height: 15px; border-radius: 2px; background: var(--ehs-primary); }
.card-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: var(--ehs-radius); padding: 16px 18px;
  box-shadow: var(--ehs-shadow); position: relative; overflow: hidden;
  border-left: 4px solid var(--ehs-primary);
}
.stat .label { color: var(--ehs-text-sub); font-size: 13px; margin-bottom: 8px; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--ehs-text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .unit { font-size: 13px; font-weight: 400; color: var(--ehs-text-sub); margin-left: 3px; }
.stat .extra { font-size: 12px; color: var(--ehs-text-sub); margin-top: 6px; }
.stat.c-blue { border-left-color: #1677c9; }
.stat.c-green { border-left-color: #00a870; }
.stat.c-orange { border-left-color: #ed7b2f; }
.stat.c-red { border-left-color: #e34d59; }
.stat.c-purple { border-left-color: #7d5fff; }
.stat.c-cyan { border-left-color: #0fb9b1; }

.mini-stat { display: flex; gap: 10px; flex-wrap: wrap; }
.mini-stat .item {
  flex: 1; min-width: 110px; background: #f7fafd; border-radius: 8px; padding: 10px 12px;
}
.mini-stat .item .k { font-size: 12px; color: var(--ehs-text-sub); }
.mini-stat .item .v { font-size: 18px; font-weight: 600; margin-top: 4px; }

/* ---------------------------------------------------------- 风险等级 */
.risk { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; line-height: 18px; }
.risk-1 { background: #e8f7f0; color: #00a870; }
.risk-2 { background: #fff4e0; color: #d97706; }
.risk-3 { background: #ffece6; color: #ed7b2f; }
.risk-4 { background: #fde8e8; color: #e34d59; }
.level-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.lv-1 { background: #9aa8b8; }
.lv-2 { background: #ed7b2f; }
.lv-3 { background: #e34d59; }
.lv-4 { background: #c0243a; }

/* ---------------------------------------------------------- 其它 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter-bar .spacer { flex: 1; }
.chart { width: 100%; height: 280px; }
.chart-sm { width: 100%; height: 210px; }
/* e-chart 为自定义元素，浏览器默认按 inline 渲染，会导致内部 100% 宽高失效 */
e-chart { display: block; width: 100%; }
.muted { color: var(--ehs-text-sub); font-size: 13px; }
.page-title { font-size: 18px; font-weight: 600; margin: 0 0 16px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 22px; }
.kv .item { display: flex; gap: 8px; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed #eef2f7; }
.kv .item .k { color: var(--ehs-text-sub); width: 84px; flex-shrink: 0; }
.kv .item .v { color: var(--ehs-text); word-break: break-all; }

.elder-head {
  display: flex; align-items: center; gap: 18px; background: #fff;
  border-radius: var(--ehs-radius); padding: 18px 22px; box-shadow: var(--ehs-shadow); margin-bottom: 16px;
}
.elder-head .avatar {
  width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #1677c9, #0fb9b1); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600;
}
.elder-head .info h2 { margin: 0 0 6px; font-size: 20px; }
.elder-head .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.elder-head .spacer { flex: 1; }
.elder-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ai-alert-item { border-left: 3px solid var(--ehs-border); padding: 12px 14px; border-radius: 8px; background: #fafcff; margin-bottom: 10px; }
.ai-alert-item.lv4 { border-left-color: #e34d59; background: #fff7f7; }
.ai-alert-item.lv3 { border-left-color: #ed7b2f; background: #fffaf5; }
.ai-alert-item.lv2 { border-left-color: #edb22f; }
.ai-alert-item .t { font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.ai-alert-item .c { color: #44546a; font-size: 13px; line-height: 1.75; white-space: pre-wrap; }
.ai-alert-item .s { color: var(--ehs-primary); font-size: 13px; margin-top: 8px; line-height: 1.7; }

.evidence { background: #f6f9fc; border-radius: 8px; padding: 12px 14px; font-size: 13px; }
.evidence .row { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px dashed #e4ebf3; }
.evidence .row:last-child { border-bottom: none; }
.evidence .f { color: var(--ehs-text-sub); width: 96px; flex-shrink: 0; }

.empty { text-align: center; color: var(--ehs-text-sub); padding: 30px 0; font-size: 13px; }

.trend-up { color: var(--ehs-danger); }
.trend-down { color: var(--ehs-ok); }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d6e4; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
