/* ============================================================
 * portal.css — 私域健康平台（登录 / 看板 / 档案）专属样式
 * 主色沿用 style.css：--brand #0F6E5C / --brand-dark / --ink
 * 适老化：大字号、大按钮、高对比
 * ============================================================ */

/* ---------------- 顶部用户条 ---------------- */
.vwub { display: flex; align-items: center; gap: 12px; }
.vwub-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.vwub-name { color: #fff; font-weight: 600; }
.vwub-link { color: rgba(255,255,255,.92) !important; }
.vwub-link:hover { text-decoration: underline; }
.vwub-out {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: .8rem; padding: 3px 11px; border-radius: 999px;
  cursor: pointer; font-family: inherit;
}
.vwub-out:hover { background: rgba(255,255,255,.26); }

.gate-loading {
  padding: 90px 24px; text-align: center;
  color: var(--ink-3); font-size: 1.05rem;
}

/* ---------------- 通用表单元件 ---------------- */
.fld { display: block; margin-bottom: 15px; }
.fld-label {
  display: block; font-size: .9rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.fld input, .fld select, .fld textarea {
  width: 100%; padding: 12px 14px; font-size: 1rem; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); transition: .16s;
}
.fld textarea { resize: vertical; line-height: 1.6; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-lighter);
}
.fld input.is-error { border-color: #D2493B; }
.fld-err, .fld-hint {
  display: block; font-size: .82rem; font-style: normal;
  margin-top: 5px; color: var(--ink-3);
}
.fld-err { color: #D2493B; min-height: 1em; }
.fld--inline { margin-bottom: 0; }
.fld--inline .fld-label { font-size: .82rem; }
.fld--inline input, .fld--inline select { min-width: 118px; }
.fld--grow { flex: 1; }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 16px; font-size: .88rem; border-radius: 8px; }
.btn--done { background: var(--brand-lighter); color: var(--brand-dark); border-color: var(--brand-lighter); cursor: default; }
.muted { color: var(--ink-3); font-weight: 400; font-size: .85em; }

/* ---------------- 登录 / 注册 ---------------- */
.auth-wrap .container {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 56px; align-items: start;
}
.auth-intro h1 { font-size: 2.5rem; line-height: 1.3; margin: 10px 0 18px; }
.auth-intro h1 em { color: var(--brand); font-style: normal; }
.auth-lead, .hero-lead { color: var(--ink-2); font-size: 1.05rem; line-height: 1.75; }
.auth-benefits { list-style: none; margin: 26px 0; padding: 0; }
.auth-benefits li {
  padding: 11px 0; border-bottom: 1px dashed var(--line);
  color: var(--ink-2); font-size: .97rem; line-height: 1.6;
}
.auth-benefits b { color: var(--ink); }
.auth-note { color: var(--ink-3); font-size: .95rem; }
.auth-note a, .auth-terms a { color: var(--brand); font-weight: 600; }

.auth-card {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 34px 32px; box-shadow: var(--shadow);
}
.auth-form + .auth-form { margin-top: 34px; padding-top: 30px; border-top: 2px dashed var(--line); }
.auth-form h2 { font-size: 1.42rem; margin-bottom: 5px; }
.auth-form-sub { color: var(--ink-3); font-size: .92rem; margin-bottom: 20px; }
.auth-msg { min-height: 1.3em; font-size: .9rem; margin: 8px 0; }
.auth-msg--err { color: #D2493B; }
.auth-msg--ok { color: var(--brand); }
.auth-terms { font-size: .8rem; color: var(--ink-3); line-height: 1.6; margin-top: 14px; }

/* ---------------- 看板页头 ---------------- */
.section--tight { padding: 44px 0 30px; }
.dash-hello {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 24px;
}
.dash-hello h1 { font-size: 1.9rem; }
.dash-date { color: var(--ink-3); font-size: .93rem; margin-top: 4px; }
.dash-actions { display: flex; gap: 10px; }
.page-head { margin-bottom: 28px; max-width: 760px; }
.page-head h1 { font-size: 2.05rem; margin: 8px 0 12px; }
.page-head p { color: var(--ink-2); line-height: 1.8; }

.section-head { max-width: 720px; margin-bottom: 26px; }
.section-head.center { text-align: center; margin-left: auto; margin-right: auto; }

/* ---------------- 风险卡 ---------------- */
.risk-card {
  display: grid; grid-template-columns: 176px 1fr; gap: 30px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 30px; box-shadow: var(--shadow); align-items: center;
}
.risk-gauge { position: relative; text-align: center; }
.risk-ring { width: 150px; height: 150px; }
.risk-ring circle { transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.3,1); }
.risk-num {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center;
}
.risk-num b { display: block; font-size: 2.5rem; color: var(--ink); line-height: 1; }
.risk-num span { display: block; font-size: .78rem; color: var(--ink-3); margin-top: 6px; }

.risk-level {
  display: inline-block; font-size: 1.12rem; font-weight: 700;
  padding: 6px 16px; border-radius: 999px; margin-bottom: 12px;
}
.risk-level--low { background: #E6F5EE; color: #16794F; }
.risk-level--mid { background: #FDF3DC; color: #9A6D05; }
.risk-level--high { background: #FCEAE8; color: #B93A2C; }
.risk-advice { color: var(--ink-2); line-height: 1.75; margin-bottom: 14px; }
.risk-list { list-style: none; margin: 0; padding: 0; }
.risk-item {
  padding: 9px 0 9px 2px; font-size: .95rem; color: var(--ink-2);
  border-top: 1px dashed var(--line); line-height: 1.55;
}
.risk-item b { margin-right: 6px; }
.risk-item--high { color: #B93A2C; }
.risk-item--ok { color: #16794F; }

/* ---------------- 体征录入 ---------------- */
.vital-entry {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 24px; margin-bottom: 26px; box-shadow: var(--shadow);
}
.ve-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.ve-tab {
  padding: 9px 20px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: .95rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .16s;
}
.ve-tab:hover { border-color: var(--brand); color: var(--brand); }
.ve-tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ve-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.ve-msg { min-height: 1.3em; font-size: .9rem; margin-top: 12px; }
.ve-msg--err { color: #D2493B; }
.ve-msg--ok { color: var(--brand); }

/* ---------------- 图表 ---------------- */
.chart-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
}
.chart-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 24px; box-shadow: var(--shadow);
}
.chart-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-lighter); }
.chart-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.chart-head h3 { font-size: 1.16rem; }
.chart-status {
  font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.chart-status--ok { background: #E6F5EE; color: #16794F; }
.chart-status--warn { background: #FDF3DC; color: #9A6D05; }
.chart-status--high { background: #FCEAE8; color: #B93A2C; }
.chart-status--low { background: #E8F0FB; color: #1B5FA8; }
.chart-status--none { background: var(--line); color: var(--ink-3); }

.chart-flag {
  background: #FDF3DC; color: #7A5605; border-radius: 9px;
  padding: 9px 13px; font-size: .85rem; line-height: 1.6; margin-bottom: 14px;
}

.chart-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.cstat {
  background: var(--bg-soft, #F6F9F8); border-radius: 10px; padding: 9px 12px;
}
.cstat-label { display: block; font-size: .76rem; color: var(--ink-3); margin-bottom: 3px; }
.cstat-val { font-size: 1.02rem; color: var(--ink); }
.cstat--warn .cstat-val { color: #B93A2C; }
.cstat--muted .cstat-val { color: var(--ink-3); font-size: .9rem; font-weight: 500; }

.chart-box { min-height: 200px; }
.chart-empty, .fc-empty {
  padding: 44px 20px; text-align: center; color: var(--ink-3);
  font-size: .93rem; background: var(--bg-soft, #F6F9F8); border-radius: 12px;
  line-height: 1.7;
}

.vwchart { width: 100%; height: auto; display: block; }
.vwchart-tick { font-size: 10.5px; fill: #7A8C87; }
.vwchart-ref { font-size: 10.5px; fill: #0F6E5C; opacity: .8; }
.vwchart-pred { font-size: 11px; fill: #0F6E5C; font-weight: 600; }
.vwchart-badge { font-size: 12px; fill: #fff; font-weight: 700; }

/* ---------------- 预测 ---------------- */
.forecast-list { display: grid; gap: 14px; }
.fc-item {
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--line);
  border-radius: 12px; padding: 18px 22px; box-shadow: var(--shadow);
}
.fc-item--high { border-left-color: #D2493B; }
.fc-item--warn { border-left-color: #E0A106; }
.fc-item--ok { border-left-color: #1F9D6B; }
.fc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.fc-ico { font-size: 1.1rem; }
.fc-window { font-weight: 700; color: var(--ink); }
.fc-badge { font-size: .78rem; font-weight: 700; padding: 3px 11px; border-radius: 999px; }
.fc-badge--high { background: #FCEAE8; color: #B93A2C; }
.fc-badge--warn { background: #FDF3DC; color: #9A6D05; }
.fc-badge--ok { background: #E6F5EE; color: #16794F; }
.fc-text { color: var(--ink-2); line-height: 1.75; font-size: .98rem; }

/* ---------------- 测评趋势 ---------------- */
.asmt-bars {
  display: grid; gap: 12px; margin-bottom: 26px;
}
.hbar-row {
  display: grid; grid-template-columns: 132px 1fr 52px 74px;
  gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px;
}
.hbar-name { font-size: .93rem; color: var(--ink); font-weight: 600; }
.hbar-track { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 999px; transition: width .8s cubic-bezier(.2,.8,.3,1); }
.hbar-low { background: #1F9D6B; }
.hbar-mid { background: #E0A106; }
.hbar-high { background: #D2493B; }
.hbar-val { font-size: .93rem; font-weight: 700; text-align: right; }
.hbar-tag { font-size: .78rem; font-weight: 700; text-align: center; padding: 3px 0; border-radius: 6px; }
.hbar-tag-low { background: #E6F5EE; color: #16794F; }
.hbar-tag-mid { background: #FDF3DC; color: #9A6D05; }
.hbar-tag-high { background: #FCEAE8; color: #B93A2C; }

.asmt-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.asmt-table { width: 100%; border-collapse: collapse; min-width: 620px; }
.asmt-table th, .asmt-table td {
  padding: 13px 16px; text-align: left; font-size: .92rem;
  border-bottom: 1px solid var(--line);
}
.asmt-table th { background: var(--brand); color: #fff; font-weight: 600; }
.asmt-table tbody tr:last-child td { border-bottom: none; }
.asmt-table tbody tr:hover { background: var(--bg-soft, #F6F9F8); }
.lv { font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.lv--low { background: #E6F5EE; color: #16794F; }
.lv--mid { background: #FDF3DC; color: #9A6D05; }
.lv--high { background: #FCEAE8; color: #B93A2C; }
.diff { font-size: .85rem; font-weight: 600; }
.diff--worse { color: #B93A2C; }
.diff--better { color: #16794F; }

/* ---------------- 用药 ---------------- */
.med-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 20px; flex-wrap: wrap;
}
.med-progress { flex: 1; min-width: 260px; }
.med-progress-bar {
  height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 9px;
}
.med-progress-bar i {
  display: block; height: 100%; background: var(--brand); border-radius: 999px;
  transition: width .8s cubic-bezier(.2,.8,.3,1);
}
.med-progress span { font-size: .95rem; color: var(--ink-2); }
.med-list { display: grid; gap: 12px; }
.med-item {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 20px; box-shadow: var(--shadow);
}
.med-info { flex: 1; }
.med-info b { display: block; font-size: 1.05rem; color: var(--ink); }
.med-info span { display: block; font-size: .86rem; color: var(--ink-3); margin-top: 3px; }
.med-time { color: var(--brand) !important; font-weight: 600; }
.med-del {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 1rem; padding: 4px 8px; border-radius: 6px;
}
.med-del:hover { background: #FCEAE8; color: #B93A2C; }

/* ---------------- 档案页 ---------------- */
.rec-layout { display: grid; grid-template-columns: 340px 1fr; gap: 28px; align-items: start; }
.panel {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 24px; box-shadow: var(--shadow);
}
.panel-title { font-size: 1.2rem; margin-bottom: 20px; }
.panel--tip { margin-top: 20px; background: var(--brand-lighter); border-color: transparent; }
.panel--tip h3 { font-size: 1.02rem; margin-bottom: 12px; }
.panel--tip ul { margin: 0; padding-left: 20px; }
.panel--tip li { font-size: .88rem; color: var(--brand-dark); line-height: 1.75; margin-bottom: 7px; }

.rec-form .rec-msg { min-height: 1.3em; font-size: .9rem; margin: 8px 0; }
.rec-msg--err { color: #D2493B; }
.rec-msg--ok { color: var(--brand); }
.rec-form-btns { display: flex; gap: 12px; justify-content: flex-end; }

.rec-add-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.rab-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.rab-tab {
  padding: 8px 17px; border-radius: 8px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: .9rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .16s;
}
.rab-tab:hover { border-color: var(--brand); color: var(--brand); }
.rab-tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.rec-timeline { display: grid; gap: 16px; }
.rec-item {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; box-shadow: var(--shadow);
}
.rec-item-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.rec-ico { font-size: 1.5rem; line-height: 1.2; }
.rec-item-title { flex: 1; }
.rec-item-title h3 { font-size: 1.08rem; margin-bottom: 4px; }
.rec-meta { font-size: .84rem; color: var(--ink-3); }
.rec-del {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  padding: 5px 9px; border-radius: 7px; opacity: .5;
}
.rec-del:hover { opacity: 1; background: #FCEAE8; }
.rec-summary { color: var(--ink-2); font-size: .95rem; line-height: 1.75; margin-bottom: 12px; }
.rec-data { border-top: 1px dashed var(--line); padding-top: 12px; }
.rec-data-title { font-size: .84rem; color: var(--ink-3); margin-bottom: 10px; font-weight: 600; }
.rec-kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.rec-kv {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--bg-soft, #F6F9F8); border-radius: 8px; padding: 8px 12px; font-size: .88rem;
}
.rec-kv span { color: var(--ink-3); }
.rec-kv b { color: var(--ink); }

.dash-empty {
  padding: 40px 20px; text-align: center; color: var(--ink-3);
  background: #fff; border: 1px dashed var(--line); border-radius: 12px;
}
.dash-empty a { color: var(--brand); font-weight: 600; }
.dash-foot { padding: 34px 0 10px; text-align: center; }
.dash-foot p { font-size: .9rem; color: var(--ink-3); }
.dash-foot a { color: var(--brand); font-weight: 600; }
.dash-disclaimer {
  max-width: 780px; margin: 14px auto 0; font-size: .82rem;
  line-height: 1.75; color: var(--ink-3);
}

/* ---------------- 量表中心新增件 ---------------- */
.asm-filter {
  display: flex; gap: 9px; flex-wrap: wrap;
  justify-content: center; margin-bottom: 28px;
}
.asm-chip {
  padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: .9rem; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: .16s;
}
.asm-chip:hover { border-color: var(--brand); color: var(--brand); }
.asm-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.asm-login-tip {
  margin-top: 30px; padding: 16px 22px; text-align: center;
  background: var(--brand-lighter); border-radius: 12px;
  color: var(--brand-dark); font-size: .95rem; line-height: 1.7;
}
.asm-login-tip a { color: var(--brand); font-weight: 700; margin-left: 4px; }
.card-done {
  display: inline-block; font-size: .7rem; font-weight: 700;
  background: var(--brand-lighter); color: var(--brand-dark);
  padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}
.asm-empty { grid-column: 1/-1; text-align: center; color: var(--ink-3); padding: 40px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  .auth-wrap .container { grid-template-columns: 1fr; gap: 34px; }
  .rec-layout { grid-template-columns: 1fr; }
  .risk-card { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .risk-body { text-align: left; width: 100%; }
}
@media (max-width: 768px) {
  .auth-intro h1 { font-size: 1.95rem; }
  .auth-card { padding: 26px 22px; }
  .chart-grid { grid-template-columns: 1fr; }
  .hbar-row { grid-template-columns: 100px 1fr 46px; }
  .hbar-tag { grid-column: 1/-1; text-align: left; padding-left: 0; }
  .fld-row { grid-template-columns: 1fr; }
  .ve-form { flex-direction: column; align-items: stretch; }
  .ve-form .btn { width: 100%; }
  .med-item { flex-wrap: wrap; }
  .page-head h1, .dash-hello h1 { font-size: 1.6rem; }
  .risk-ring { width: 128px; height: 128px; }
}

.chart-flag--danger { background: #FCEAE8; color: #B93A2C; }

/* hidden 属性必须能压过display，避免条件字段（如血糖"餐次"）误显示 */
[hidden] { display: none !important; }

/* 录入标签：单位用括号分隔，避免与文字挤在一起 */
.ve-form .fld-label { white-space: nowrap; }
.ve-form .fld-label > span:not([id]) { margin-left: 4px; color: var(--ink-3); font-weight: 400; }
.ve-form #unit1 { margin-left: 4px; color: var(--ink-3); font-weight: 400; }
