/* =====================================================================
   Demo测试医院 · 诊后随访系统 — 基础层 base.css
   ---------------------------------------------------------------------
   职责：设计令牌（颜色/字体/圆角/阴影/动效曲线）、reset、排版、
        纸张纹理、通用工具类、外壳布局（深墨侧栏 + 羊皮纸主区）、
        页面转场幕 .page-veil、路由进度条 .route-progress。
   组件视觉见 components.css；交互与动效见 fx.css。
   视觉基调：羊皮纸暖色 + 深墨结构 + 赭橙点缀；莱茵几何语言只出现在
   导航/框架/转场/按钮/交互反馈，正文阅读区保持干净。
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. 设计令牌
   --------------------------------------------------------------------- */
:root {
  /* —— 纸面 —— */
  --paper: #f4eee1;
  --paper-2: #fbf8f1;
  --paper-3: #eee5d3;
  --paper-4: #e6dbc4;

  /* —— 墨色 —— */
  --ink: #231e19;
  --ink-2: #4f463c;
  --ink-3: #7f7466;
  --ink-4: #a99e8e;

  /* —— 细线 —— */
  --line: #e0d6c2;
  --line-2: #cbbda3;

  /* —— 赭橙（唯一强调色） —— */
  --accent: #c1522d;
  --accent-2: #9c4023;
  --accent-soft: #f1dbcf;
  --accent-tint: #f9eee6;

  /* —— 状态色 —— */
  --sage: #5f8469;
  --sage-soft: #dfe8de;
  --amber: #b8871f;
  --amber-soft: #f3e7c8;
  --red: #a83c33;
  --red-soft: #f2dcd7;
  --blue: #3d5c86;
  --blue-soft: #dde4ee;

  /* 状态色的深墨文字变体（保证小字号对比度） */
  --sage-ink: #3f6349;
  --amber-ink: #7c5c12;
  --red-ink: #8c2f27;
  --blue-ink: #2f4a6e;

  /* —— 深墨侧栏 —— */
  --rail: #201b16;
  --rail-2: #2b241d;
  --rail-line: #3a3128;
  --rail-ink: #f3ead9;
  --rail-ink-2: #b8ab96;

  /* —— 字体 —— */
  --serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', 'SimSun',
    Georgia, 'Times New Roman', serif;
  --sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei',
    'Noto Sans SC', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  /* —— 圆角 —— */
  --r-xs: 4px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* —— 阴影（纸张上的低对比投影） —— */
  --shadow-sm: 0 1px 2px rgba(60, 44, 20, 0.06);
  --shadow: 0 1px 2px rgba(60, 44, 20, 0.06), 0 10px 30px -14px rgba(60, 44, 20, 0.22);
  --shadow-lg: 0 2px 4px rgba(60, 44, 20, 0.07), 0 24px 60px -24px rgba(35, 30, 25, 0.4);

  /* —— 动效（160–420ms） —— */
  --fx-ease: cubic-bezier(0.22, 0.8, 0.28, 1);
  --fx-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fx-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 160ms;
  --t: 220ms;
  --t-slow: 320ms;
  --t-view: 420ms;

  /* —— 布局 —— */
  --rail-w: 248px;
  --rail-w-client: 224px;
  --topbar-h: 64px;
  --content-max: 1320px;

  /* —— 层叠 —— */
  --z-topbar: 40;
  --z-scrim: 55;
  --z-drawer: 60;
  --z-modal: 70;
  --z-popover: 80;
  --z-toast: 90;
  --z-veil: 980;
  --z-route-progress: 1000;
}

/* ---------------------------------------------------------------------
   2. Reset
   --------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  /* 纸张：暖白高光 + 极淡赭色晕染 + 细噪点纹理 */
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 620px at 8% -12%, rgba(255, 250, 240, 0.9), transparent 62%),
    radial-gradient(900px 520px at 102% -6%, rgba(241, 219, 207, 0.42), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.47 0 0 0 0 0.36 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, repeat;
  background-attachment: scroll, scroll, scroll;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.overlay-open {
  overflow: hidden;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

hr {
  border: 0;
}

::selection {
  color: var(--ink);
  background: var(--accent-soft);
}

:focus-visible {
  outline: 2px solid rgba(193, 82, 45, 0.62);
  outline-offset: 2px;
}

/* 滚动条：羊皮纸细线 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid transparent;
  border-radius: 8px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ---------------------------------------------------------------------
   3. 排版
   --------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: 0.03em;
  color: var(--ink);
}

h1 {
  font-size: 26px;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 17px;
}
h4 {
  font-size: 14px;
  letter-spacing: 0.04em;
}

p {
  line-height: 1.72;
}

strong,
b {
  font-weight: 600;
}

small {
  font-size: 11.5px;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.92em;
}

.ico {
  display: block;
  flex: none;
}

/* ---------------------------------------------------------------------
   4. 通用工具类
   --------------------------------------------------------------------- */
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.num {
  font-variant-numeric: tabular-nums;
}

.serif {
  font-family: var(--serif);
}

.muted {
  color: var(--ink-3);
}

.dim {
  color: var(--ink-4);
}

.accent-text {
  color: var(--accent-2);
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.hidden,
[hidden] {
  display: none !important;
}

.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;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-wrap {
  flex-wrap: wrap;
}

.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.spacer {
  flex: 1 1 auto;
}

.text-right {
  text-align: right;
}

/* 等宽编号标签：莱茵式小索引 */
.index-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  background: var(--accent-tint);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-xs);
}

/* 细线网格底纹：只用于框架/装饰区域 */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(35, 30, 25, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(35, 30, 25, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* 四角角标（装饰容器）：<span class="corner"></span> 放在 position:relative 父级内 */
.corner {
  --corner-len: 10px;
  --corner-w: 1.5px;
  --corner-color: var(--accent);
  position: absolute;
  inset: 7px;
  z-index: 2;
  pointer-events: none;
  background-image:
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color)),
    linear-gradient(var(--corner-color), var(--corner-color));
  background-repeat: no-repeat;
  background-size:
    var(--corner-len) var(--corner-w), var(--corner-w) var(--corner-len),
    var(--corner-len) var(--corner-w), var(--corner-w) var(--corner-len),
    var(--corner-len) var(--corner-w), var(--corner-w) var(--corner-len),
    var(--corner-len) var(--corner-w), var(--corner-w) var(--corner-len);
  background-position: left top, left top, right top, right top, left bottom, left bottom,
    right bottom, right bottom;
  opacity: 0.55;
}

/* ---------------------------------------------------------------------
   5. 外壳布局：深墨侧栏 + 羊皮纸主区
   --------------------------------------------------------------------- */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: transparent;
}

/* 客户端：侧栏略窄，正文最大宽收敛 */
.shell-client {
  grid-template-columns: var(--rail-w-client) minmax(0, 1fr);
}

.shell-client .view {
  max-width: 1080px;
}

/* 无侧栏外壳（窄屏/特殊页面可用） */
.shell.no-rail {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------------------------------------------------------------------
   5.1 侧栏
   --------------------------------------------------------------------- */
.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  color: var(--rail-ink);
  background: var(--rail);
  border-right: 1px solid #17120e;
}

/* 斜线纹理 + 右侧赭橙细分隔光 */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(243, 234, 217, 0.035) 0 1px,
    transparent 1px 7px
  );
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  z-index: 1;
  width: 1px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(193, 82, 45, 0.55) 30%,
    rgba(193, 82, 45, 0.55) 70%,
    transparent
  );
  opacity: 0.35;
}

.sidebar > * {
  position: relative;
  z-index: 2;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--rail-line);
  border-radius: 0;
}

a.side-brand:focus-visible {
  outline: 2px solid rgba(241, 219, 207, 0.62);
  outline-offset: -2px;
}

/* 机构标记：赭橙方标 + 医疗十字 */
.brand-mark {
  position: relative;
  display: block;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 248, 242, 0.18);
}

.brand-mark::before,
.brand-mark::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 1px;
  background: var(--rail-ink);
  transform: translate(-50%, -50%);
}

.brand-mark::before {
  width: 4px;
  height: 17px;
}

.brand-mark::after {
  width: 17px;
  height: 4px;
}

.brand-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.25;
  color: var(--rail-ink);
  white-space: nowrap;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  line-height: 1.3;
  color: var(--rail-ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 14px 12px 20px;
  overflow-y: auto;
  scrollbar-color: var(--rail-line) transparent;
}

.side-nav::-webkit-scrollbar {
  width: 4px;
}

.side-nav::-webkit-scrollbar-thumb {
  border: 0;
  background: var(--rail-line);
  border-radius: 4px;
}

/* 分组：只写标题文字，或 .side-group > .side-group-title + 若干 .side-item 均可 */
.side-group {
  display: block;
  margin: 14px 4px 4px;
}

.side-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
  opacity: 0.72;
  white-space: nowrap;
}

.side-group-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rail-line), transparent);
}

/* 兼容：.side-group 直接承载标题文字 */
.side-group:not(:has(.side-group-title)) {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 4px 6px;
  padding: 0 8px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
  opacity: 0.72;
}

.side-group:not(:has(.side-group-title))::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rail-line), transparent);
}

.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--rail-ink-2);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  outline-offset: -2px;
  transition: color var(--t) var(--fx-ease), background var(--t) var(--fx-ease),
    border-color var(--t) var(--fx-ease);
}

.side-ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 20px;
  color: currentColor;
  opacity: 0.78;
  transition: opacity var(--t), color var(--t);
}

.side-ico .ico {
  width: 17px;
  height: 17px;
}

.side-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-index {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--rail-ink-2);
  opacity: 0.45;
  transition: opacity var(--t), color var(--t);
}

.side-item:hover {
  color: var(--rail-ink);
  background: rgba(243, 234, 217, 0.055);
  border-color: rgba(243, 234, 217, 0.08);
}

.side-item:hover .side-ico {
  opacity: 1;
}

.side-item.active {
  color: var(--rail-ink);
  background: var(--rail-2);
  border-color: var(--rail-line);
  box-shadow: inset 2px 0 0 var(--accent);
}

.side-item.active .side-ico {
  color: var(--accent-soft);
  opacity: 1;
}

.side-item.active .side-index {
  color: var(--accent-soft);
  opacity: 0.9;
}

.side-item:focus-visible {
  outline: 2px solid rgba(241, 219, 207, 0.62);
  outline-offset: -2px;
}

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding: 12px 12px 14px;
  border-top: 1px solid var(--rail-line);
}

/* 侧栏内的账号信息条（可选内层） */
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 10px;
  min-width: 0;
}

.side-user .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
  background: var(--rail-2);
  border-color: var(--rail-line);
  color: var(--rail-ink);
}

.side-user-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.side-user-name {
  font-size: 12.5px;
  color: var(--rail-ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-role {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--rail-ink-2);
  opacity: 0.8;
}

/* 窄屏侧栏开关（需页面按钮配合 .shell.nav-open） */
.side-toggle {
  display: none;
}

/* ---------------------------------------------------------------------
   5.2 主区 / 顶栏 / 视图
   --------------------------------------------------------------------- */
.app-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background: transparent;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  flex: none;
  align-items: center;
  gap: 18px;
  height: var(--topbar-h);
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.86);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}

.topbar-left {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* 机构标识（登录页 / 随访页顶栏也可复用） */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand .brand-title {
  color: var(--ink);
}

.brand .brand-sub {
  color: var(--ink-3);
}

/* 顶栏中部（状态芯片等） */
.topbar-center {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* 面包屑（ui.setCrumb 生成 .crumb-item / .crumb-sep / .current） */
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: var(--ink-3);
}

.crumb-item {
  display: inline-flex;
  align-items: center;
  max-width: 24ch;
  padding: 2px 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--ink-3);
  text-overflow: ellipsis;
}

.crumb-item.current {
  color: var(--ink);
  font-weight: 500;
}

a.crumb-item:focus-visible {
  outline: 2px solid rgba(193, 82, 45, 0.55);
  outline-offset: 2px;
  border-radius: 3px;
}

.crumb-sep {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  opacity: 0.85;
}

/* 顶栏搜索：<div class="topbar-search"><svg class="ico">…</svg><input class="input"></div> */
.topbar-search {
  position: relative;
  display: flex;
  flex: 0 1 300px;
  align-items: center;
  min-width: 0;
  margin-left: auto;
}

.topbar-search > .ico {
  position: absolute;
  left: 11px;
  z-index: 1;
  color: var(--ink-4);
  pointer-events: none;
  transition: color var(--t);
}

.topbar-search .input,
.topbar-search > input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  font-size: 13px;
  background: var(--paper-2);
  border-color: var(--line);
  border-radius: var(--r-sm);
}

.topbar-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

/* 视图舞台：转场容器（router outlet） */
.view-stage {
  position: relative;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  min-height: calc(100dvh - var(--topbar-h));
}

/* 转场页：只承担进出动画，不负责内边距 */
.view-page {
  position: relative;
  flex: 1 0 auto;
  width: 100%;
}

/* 视图内容容器：统一内边距与最大宽 */
.view {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 26px 30px 64px;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.view-head-main {
  min-width: 0;
}

.view-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.view-kicker::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.view-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.view-sub {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-3);
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-body {
  display: grid;
  gap: 18px;
}

/* ---------------------------------------------------------------------
   5.3 区块
   --------------------------------------------------------------------- */
.section {
  margin-top: 26px;
}

.section:first-child {
  margin-top: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.section-rule {
  flex: 1 1 auto;
  min-width: 24px;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), var(--line) 40%, transparent);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ---------------------------------------------------------------------
   6. 页面转场幕 .page-veil（五联几何幕，进入/离开 + 分段进度 + 角标）
   markup 沿用：
   <div class="page-veil" id="page-veil" aria-hidden="true">
     <span class="pv-line"></span>
     <span class="pv-bar" aria-hidden="true">12×<i></i></span>
     <i></i>×5
   </div>
   状态类：veil-cover（合拢）/ veil-open（收起）/ veil-done（隐藏）
   --------------------------------------------------------------------- */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: var(--z-veil);
  display: none;
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
  pointer-events: none;
  counter-reset: pv;
}

html.js .page-veil {
  display: grid;
}

.page-veil > i {
  position: relative;
  display: block;
  counter-increment: pv;
  background-image:
    repeating-linear-gradient(135deg, rgba(120, 96, 64, 0.05) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #f7f0e3 0%, #e9dcc3 100%);
  box-shadow: inset 0 0 0 1px rgba(203, 189, 163, 0.4);
  will-change: transform;
}

/* 面板编号：01–05（增强的莱茵式等宽标记） */
.page-veil > i::before {
  content: counter(pv, decimal-leading-zero);
  position: absolute;
  right: 0;
  bottom: 9%;
  left: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-align: center;
  color: rgba(120, 96, 64, 0.34);
}

/* 面板接缝：赭橙细光 */
.page-veil > i::after {
  content: '';
  position: absolute;
  top: 12%;
  right: 0;
  bottom: 12%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(193, 82, 45, 0.5), transparent);
}

/* 横向准星线 */
.page-veil .pv-line {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 4%,
    rgba(193, 82, 45, 0.55) 50%,
    transparent 96%
  );
  transform: scaleX(0);
}

/* 准星线下方机构标记（增强） */
.page-veil .pv-line::after {
  content: 'Demo测试医院 · 健康管理中心';
  position: absolute;
  top: 16px;
  left: 50%;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.34em;
  white-space: nowrap;
  color: rgba(120, 96, 64, 0.55);
  transform: translateX(-50%);
}

/* 中心分段进度条 */
.page-veil .pv-bar {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
  width: 180px;
  height: 3px;
  opacity: 0;
  transform: translate(-50%, -50%);
}

.page-veil.veil-cover .pv-bar {
  opacity: 1;
}

.page-veil .pv-bar i {
  background: rgba(193, 82, 45, 0.22);
}

.page-veil.veil-cover .pv-bar i {
  animation: pv-seg 0.62s var(--fx-ease) infinite;
}

.page-veil.veil-cover .pv-bar i:nth-child(2) {
  animation-delay: 0.04s;
}
.page-veil.veil-cover .pv-bar i:nth-child(3) {
  animation-delay: 0.08s;
}
.page-veil.veil-cover .pv-bar i:nth-child(4) {
  animation-delay: 0.12s;
}
.page-veil.veil-cover .pv-bar i:nth-child(5) {
  animation-delay: 0.16s;
}
.page-veil.veil-cover .pv-bar i:nth-child(6) {
  animation-delay: 0.2s;
}
.page-veil.veil-cover .pv-bar i:nth-child(7) {
  animation-delay: 0.24s;
}
.page-veil.veil-cover .pv-bar i:nth-child(8) {
  animation-delay: 0.28s;
}
.page-veil.veil-cover .pv-bar i:nth-child(9) {
  animation-delay: 0.32s;
}
.page-veil.veil-cover .pv-bar i:nth-child(10) {
  animation-delay: 0.36s;
}
.page-veil.veil-cover .pv-bar i:nth-child(11) {
  animation-delay: 0.4s;
}
.page-veil.veil-cover .pv-bar i:nth-child(12) {
  animation-delay: 0.44s;
}

@keyframes pv-seg {
  0%,
  100% {
    background: rgba(193, 82, 45, 0.16);
  }
  45% {
    background: rgba(193, 82, 45, 0.85);
  }
}

/* 四角角标 */
.page-veil::before,
.page-veil::after {
  content: '';
  position: absolute;
  z-index: 2;
  width: 26px;
  height: 26px;
  border: 1.5px solid rgba(193, 82, 45, 0.55);
  opacity: 0;
}

.page-veil::before {
  top: 20px;
  left: 20px;
  border-right: 0;
  border-bottom: 0;
}

.page-veil::after {
  right: 20px;
  bottom: 20px;
  border-top: 0;
  border-left: 0;
}

/* 离开：幕布自上下合拢（cover） */
.page-veil.veil-cover > i {
  animation: veil-close-up 0.44s var(--fx-ease) both;
}

.page-veil.veil-cover > i:nth-of-type(even) {
  animation-name: veil-close-down;
}

.page-veil.veil-cover > i:nth-of-type(1) {
  animation-delay: 0.06s;
}
.page-veil.veil-cover > i:nth-of-type(2) {
  animation-delay: 0.03s;
}
.page-veil.veil-cover > i:nth-of-type(3) {
  animation-delay: 0s;
}
.page-veil.veil-cover > i:nth-of-type(4) {
  animation-delay: 0.03s;
}
.page-veil.veil-cover > i:nth-of-type(5) {
  animation-delay: 0.06s;
}

.page-veil.veil-cover .pv-line {
  animation: veil-line 0.5s var(--fx-ease) both;
}

.page-veil.veil-cover::before,
.page-veil.veil-cover::after {
  animation: veil-corner 0.5s var(--fx-ease) both;
}

/* 进入：幕布向上下收起（open） */
.page-veil.veil-open > i {
  animation: veil-open-up 0.62s var(--fx-out) both;
}

.page-veil.veil-open > i:nth-of-type(even) {
  animation-name: veil-open-down;
}

.page-veil.veil-open > i:nth-of-type(1) {
  animation-delay: 0.1s;
}
.page-veil.veil-open > i:nth-of-type(2) {
  animation-delay: 0.05s;
}
.page-veil.veil-open > i:nth-of-type(3) {
  animation-delay: 0s;
}
.page-veil.veil-open > i:nth-of-type(4) {
  animation-delay: 0.05s;
}
.page-veil.veil-open > i:nth-of-type(5) {
  animation-delay: 0.1s;
}

.page-veil.veil-open .pv-line {
  animation: veil-line 0.72s var(--fx-ease) both;
}

.page-veil.veil-open::before,
.page-veil.veil-open::after {
  animation: veil-corner 0.8s var(--fx-ease) 0.05s both;
}

.page-veil.veil-done {
  display: none !important;
}

@keyframes veil-open-up {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-102%);
  }
}

@keyframes veil-open-down {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(102%);
  }
}

@keyframes veil-close-up {
  from {
    transform: translateY(-102%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes veil-close-down {
  from {
    transform: translateY(102%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes veil-line {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }
  35% {
    transform: scaleX(1);
    opacity: 0.95;
  }
  100% {
    transform: scaleX(1);
    opacity: 0;
  }
}

@keyframes veil-corner {
  0% {
    opacity: 0;
    transform: scale(1.35);
  }
  45% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* ---------------------------------------------------------------------
   7. 路由进度条 .route-progress
   router：classList.add('on') + style.setProperty('--progress','68%')
   结束时移除 .on 并把 --progress 归零（宽度过渡回 0 并淡出）
   --------------------------------------------------------------------- */
.route-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: var(--z-route-progress);
  height: 2px;
  overflow: hidden;
  pointer-events: none;
  background: rgba(193, 82, 45, 0.14);
  opacity: 0;
  transition: opacity 0.2s var(--fx-ease);
}

.route-progress.on {
  opacity: 1;
}

.route-progress::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--progress, 0%);
  max-width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent) 60%, #dd9a78);
  box-shadow: 0 0 8px rgba(193, 82, 45, 0.5);
  transition: width 0.24s var(--fx-out);
}

.route-progress.done {
  opacity: 0;
}

/* ---------------------------------------------------------------------
   8. 响应式
   --------------------------------------------------------------------- */
@media (max-width: 1180px) {
  :root {
    --rail-w: 226px;
    --rail-w-client: 210px;
  }

  .view {
    padding: 22px 24px 56px;
  }
}

@media (max-width: 900px) {
  :root {
    --topbar-h: 58px;
  }

  .shell,
  .shell-client {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 侧栏改为抽屉式：页面给 .shell 加 .nav-open */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 75;
    width: min(286px, 84vw);
    border-right: 1px solid #17120e;
    box-shadow: 24px 0 60px -30px rgba(0, 0, 0, 0.6);
    transform: translateX(-102%);
    transition: transform var(--t-slow) var(--fx-out);
  }

  .shell.nav-open .sidebar,
  .shell-client.nav-open .sidebar {
    transform: none;
  }

  .side-toggle {
    display: inline-grid;
  }

  .app-main {
    grid-column: 1 / -1;
  }

  .app-topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .topbar-search {
    flex: 1 1 auto;
    max-width: 260px;
  }

  .account-btn .account-role {
    display: none;
  }

  .view {
    padding: 18px 16px 48px;
  }

  .view-title {
    font-size: 22px;
  }

  .view-head {
    margin-bottom: 18px;
  }
}

@media (max-width: 620px) {
  .topbar-search {
    display: none;
  }

  .crumb-item {
    max-width: 16ch;
  }

  .account-btn .account-name {
    display: none;
  }
}

/* ---------------------------------------------------------------------
   9. 无障碍：尊重 prefers-reduced-motion（关闭动效时功能完整）
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .page-veil,
  .route-progress {
    display: none !important;
  }

  html.page-ready body {
    opacity: 1;
  }
}

/* =====================================================================
   10. 环境衬底：莱茵式几何背景（低对比、固定视差、只做氛围）
   —— 仅在页面留白处可见，卡片与正文阅读区保持干净
   ===================================================================== */
body {
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 105% at 50% 42%, transparent 58%, rgba(126, 102, 70, 0.07) 100%),
    radial-gradient(1200px 620px at 8% -12%, rgba(255, 250, 240, 0.92), transparent 62%),
    radial-gradient(900px 520px at 102% -6%, rgba(241, 219, 207, 0.4), transparent 60%),
    linear-gradient(to right, rgba(86, 68, 45, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(86, 68, 45, 0.035) 1px, transparent 1px),
    linear-gradient(to right, rgba(193, 82, 45, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(193, 82, 45, 0.045) 1px, transparent 1px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.47 0 0 0 0 0.36 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat, repeat, repeat, repeat;
  background-size: auto, auto, auto, 28px 28px, 28px 28px, 168px 168px, 168px 168px, 160px 160px;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed, fixed, fixed, scroll, scroll, scroll, scroll, scroll;
}

/* 主区顶部柔光，让固定背景与内容过渡自然 */
.app-main {
  background: linear-gradient(180deg, rgba(251, 248, 241, 0.55) 0%, rgba(251, 248, 241, 0) 240px);
}

/* 顶栏下沿细光 + 侧栏顶部赭色微光 */
.app-topbar::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 2%, rgba(193, 82, 45, 0.22) 18%, transparent 46%, transparent 100%);
}
.sidebar::after {
  opacity: 0.45;
}
.side-brand { position: relative; }
.side-brand::after {
  content: '';
  position: absolute;
  right: 16px;
  bottom: -1px;
  left: 16px;
  height: 1px;
  background: linear-gradient(90deg, rgba(193, 82, 45, 0.35), transparent);
  opacity: 0.6;
}

/* 深墨侧栏背景加一层暖光与细网格，避免纯色板结 */
.sidebar {
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(193, 82, 45, 0.1), transparent 58%),
    linear-gradient(180deg, #221d17 0%, #1b1712 100%);
}
.sidebar::before {
  background-image:
    repeating-linear-gradient(135deg, rgba(243, 234, 217, 0.032) 0 1px, transparent 1px 7px),
    linear-gradient(to right, rgba(243, 234, 217, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(243, 234, 217, 0.03) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}

/* 页面转场幕：中心菱形准星（增强转场识别） */
.page-veil .pv-line::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  border: 1px solid rgba(193, 82, 45, 0.55);
  transform: rotate(45deg);
  opacity: 0;
}
.page-veil.veil-open .pv-line::before {
  animation: pv-cross 0.7s var(--fx-ease) both;
}
.page-veil.veil-cover .pv-line::before {
  animation: pv-cross 0.5s var(--fx-ease) both;
}
@keyframes pv-cross {
  0% { opacity: 0; transform: rotate(45deg) scale(0.4); }
  40% { opacity: 0.9; transform: rotate(45deg) scale(1); }
  100% { opacity: 0; transform: rotate(45deg) scale(1.5); }
}

@media (prefers-reduced-motion: reduce) {
  .page-veil .pv-line::before { display: none; }
}

/* =====================================================================
   11. 环境衬底动效：莱茵式几何线条缓慢漂移 / 呼吸 / 光带扫过
   —— 只在留白处流动，低对比、低速度；尊重 prefers-reduced-motion
   ===================================================================== */
body::before {
  content: '';
  position: fixed;
  top: -9%;
  right: -11%;
  bottom: -9%;
  left: -11%;
  z-index: -1;
  pointer-events: none;
  background: url('/assets/ambient-rhine.svg') center center / cover no-repeat;
  opacity: 0.82;
  will-change: transform, opacity;
  animation: ambient-drift 38s cubic-bezier(0.42, 0, 0.25, 1) infinite alternate,
    ambient-breathe 14s ease-in-out infinite;
}

body::after {
  content: '';
  position: fixed;
  top: -25%;
  right: -25%;
  bottom: -25%;
  left: -25%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    112deg,
    transparent 24%,
    rgba(255, 250, 240, 0.42) 42%,
    rgba(193, 82, 45, 0.045) 50%,
    rgba(255, 250, 240, 0.3) 58%,
    transparent 76%
  );
  background-size: 240% 240%;
  opacity: 0.5;
  will-change: background-position, opacity;
  animation: ambient-sweep 30s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  0% {
    transform: translate3d(-2.4%, -1.6%, 0) rotate(-0.9deg) scale(1.018);
  }
  100% {
    transform: translate3d(2.6%, 1.8%, 0) rotate(1deg) scale(1.055);
  }
}

@keyframes ambient-breathe {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.93;
  }
}

@keyframes ambient-sweep {
  0% {
    background-position: 4% 10%;
    opacity: 0.4;
  }
  50% {
    opacity: 0.62;
  }
  100% {
    background-position: 96% 90%;
    opacity: 0.34;
  }
}

/* 登录页右侧装饰弧线同步轻微漂移，避免与全站衬底割裂 */
.login-panel::after {
  animation: login-arc-drift 30s ease-in-out infinite alternate;
}

@keyframes login-arc-drift {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    opacity: 0.86;
  }
  100% {
    transform: translate3d(-2%, 1.8%, 0) rotate(1.1deg) scale(1.045);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .login-panel::after {
    animation: none !important;
  }
  body::before {
    opacity: 0.75;
    transform: none;
  }
  body::after {
    opacity: 0.35;
    background-position: 50% 50%;
  }
}
