[hidden] { display: none !important; }
:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #17324a;
  background: #f3f6f9;
  --app-bg: #f3f6f9;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-info: #eef7fb;
  --border: #d8e3ea;
  --border-strong: #bdcdd7;
  --text: #17324a;
  --text-muted: #5d7283;
  --brand: #176b8f;
  --brand-dark: #173f57;
  --brand-soft: #e9f4f8;
  --success: #176b46;
  --success-bg: #e9f6ef;
  --warning: #8a5a00;
  --warning-bg: #fff6dc;
  --danger: #a52a22;
  --danger-bg: #fff0ef;
  --info: #1f6685;
  --info-bg: #eaf5fa;
  --shadow-sm: 0 6px 20px rgba(31, 72, 96, .06);
  --shadow-md: 0 12px 32px rgba(31, 72, 96, .09);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--app-bg); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--app-bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
button:disabled { opacity: .58; cursor: not-allowed !important; }
a { color: var(--brand); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--brand-dark);
  color: #fff;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.28) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 5px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.24); border-radius: 999px; }
.app-brand { display: grid; gap: 5px; padding: 2px 8px 15px; border-bottom: 1px solid rgba(255,255,255,.15); }
.app-brand strong { font-size: 23px; letter-spacing: .03em; }
.app-brand span { font-size: 12px; line-height: 1.5; color: #c9dce7; }
.app-nav { display: grid; gap: 11px; margin-top: 12px; }
.app-nav__group { display: grid; gap: 2px; }
.app-nav__heading { margin: 0; padding: 3px 11px; font-size: 11px; line-height: 1.4; font-weight: 600; color: #92b2c4; letter-spacing: .12em; }
.app-nav__item {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 7px 11px;
  background: transparent;
  color: #e4eff5;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.app-nav__item:hover, .app-nav__item:focus-visible { background: rgba(255,255,255,.1); color: #fff; }
.app-nav__item.is-active { background: #fff; color: var(--brand-dark); font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.app-account { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; margin-top: auto; padding: 13px 7px 0; border-top: 1px solid rgba(255,255,255,.15); }
.app-account__text { min-width: 0; display: grid; gap: 2px; }
.app-account__text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-account__text span { color: #c8d9e5; font-size: 12px; }
.app-account__logout { min-height: 32px !important; padding: 6px 10px !important; margin: 0 !important; background: rgba(255,255,255,.13) !important; }
.app-main { min-width: 0; padding: 30px clamp(20px, 3.5vw, 54px) 64px; }
.app-mobile-header { display: none; }
.route-outlet { width: min(1280px, 100%); margin: 0 auto; outline: none; }

.page-stack { display: grid; gap: 18px; }
.page-header { display: grid; gap: 7px; margin-bottom: 22px; }
.page-header h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); line-height: 1.25; letter-spacing: -.02em; }
.page-header h2 { margin: 0; }
.page-header p { max-width: 880px; margin: 0; color: var(--text-muted); line-height: 1.7; }
.eyebrow { margin: 0 !important; color: var(--brand) !important; font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.section-heading { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: center; }
.section-heading h2, .section-heading h3 { margin: 0; }
.section-heading p { margin: 0; color: var(--text-muted); }

.content-card,
.identity-panel,
.status-card,
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.content-card h2, .identity-panel h2, .status-card h2, .panel h2 { margin: 0 0 14px; font-size: 21px; }
.content-card h3, .identity-panel h3, .status-card h3, .panel h3 { margin: 0 0 10px; }
.content-card p, .identity-panel p, .panel p { line-height: 1.65; }
.content-card--compact { padding: 16px 18px; }
.content-card--soft { background: var(--surface-soft); }
.content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.card-list { display: grid; gap: 12px; }
.card-list > .content-card { box-shadow: none; }

.status-card--error { border-color: #edb8b5; }
.status-card--error button { border: 0; border-radius: 9px; padding: 10px 16px; color: #fff; background: var(--danger); cursor: pointer; }
.status-row { display: grid; grid-template-columns: minmax(130px, .75fr) minmax(0, 1.65fr); gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid #edf2f5; }
.status-row:last-child { border-bottom: 0; }
.status-row__label { color: var(--text-muted); }
.status-row__value { min-width: 0; overflow-wrap: anywhere; }
.status-row--ok .status-row__value { color: var(--success); }
.status-row--error .status-row__value { color: var(--danger); }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.metric-card { display: grid; gap: 7px; align-content: start; min-height: 112px; padding: 17px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card strong { font-size: 28px; line-height: 1.1; }
.metric-card span { color: var(--text-muted); }
.metric-card--success { border-color: #a9d4ba; background: #f6fcf8; }
.metric-card--warning { border-color: #e7cc87; background: #fffdf6; }
.metric-card--danger { border-color: #e7aaa5; background: #fff8f7; }
.metric-card--info { border-color: #a7cedf; background: #f7fcfe; }

.filter-panel, .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.form-grid, .patient-form, .patient-edit-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-field { min-width: 0; display: grid; gap: 7px; color: var(--text-muted); }
.form-field > span:first-child { font-size: 14px; font-weight: 600; color: #40596c; }
.form-field--full { grid-column: 1 / -1; }
.route-outlet input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.route-outlet select,
.route-outlet textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
}
.route-outlet textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
.route-outlet input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-soft); }
.route-outlet input::placeholder, .route-outlet textarea::placeholder { color: #8494a0; }
.route-outlet label { line-height: 1.45; }
.form-help, .muted-block, .muted { color: var(--text-muted); line-height: 1.65; overflow-wrap: anywhere; }
.form-message { min-height: 22px; margin: 8px 0 0; color: var(--danger); line-height: 1.55; }
.form-message.is-success { color: var(--success); }
.form-message.is-error { color: var(--danger); }
.form-message:empty { display: none; }

.primary-button,
.secondary-button,
.danger-button,
.route-outlet button:not(.workbench-card):not(.app-nav__item):not(.patient-tab-button) {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease;
}
.primary-button { margin: 0; color: #fff; background: var(--brand); }
.secondary-button { margin: 0; color: #fff; background: #587286; }
.danger-button { margin: 0; color: #fff; background: var(--danger); }
.primary-button:hover, .secondary-button:hover, .danger-button:hover,
.route-outlet button:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(35,74,96,.14); }
.page-actions, .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.status-banner, .notice-box, .notice {
  margin: 0;
  border: 1px solid #cfe1e9;
  background: var(--surface-info);
  border-radius: 10px;
  padding: 12px 14px;
  color: #496476;
  line-height: 1.6;
}
.status-banner.is-success { border-color: #b7d9c4; background: var(--success-bg); color: var(--success); }
.status-banner.is-warning { border-color: #ead497; background: var(--warning-bg); color: var(--warning); }
.status-banner.is-error { border-color: #edb7b3; background: var(--danger-bg); color: var(--danger); }
.status-badge, .patient-badge, .template-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}
.status-badge--success, .patient-badge--success, .template-status--active { background: var(--success-bg); color: var(--success); }
.status-badge--warning, .patient-badge--warning { background: var(--warning-bg); color: var(--warning); }
.status-badge--danger, .patient-badge--danger { background: var(--danger-bg); color: var(--danger); }
.status-badge--info, .patient-badge--info { background: var(--info-bg); color: var(--info); }
.template-status--history { background: #edf1f4; color: #596d7c; }

.empty-state { padding: 30px 20px; text-align: center; color: var(--text-muted); background: var(--surface-soft); border: 1px dashed #cbd8df; border-radius: 12px; line-height: 1.65; }
.error-text { color: var(--danger); }
.code-block { max-width: 100%; margin: 10px 0 0; padding: 13px; border: 1px solid #dbe4e9; border-radius: 9px; background: #f7f9fa; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; font: 12px/1.55 Consolas, "Microsoft YaHei", monospace; color: #284356; }
.technical-details { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.technical-details summary { padding: 11px 13px; cursor: pointer; color: var(--brand); font-weight: 700; }
.technical-details .code-block { margin: 0 12px 12px; }

.data-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid #e8eef2; text-align: left; vertical-align: top; }
.data-table th { position: sticky; top: 0; z-index: 1; background: #f1f6f8; color: #466072; font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f8fbfc; }

.loading-card { min-height: 240px; display: grid; place-content: center; justify-items: center; gap: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.loading-spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid #d8e7ef; border-top-color: var(--brand); animation: app-spin .8s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }
.page-error-card { max-width: 720px; padding: 28px; background: #fff; border: 1px solid #e4b9b9; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.page-error-card h1 { margin: 8px 0; }

.login-card { width: min(460px, 100%); margin: 6vh auto 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-md); }
.login-card h1 { margin: 8px 0 12px; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
.login-form input { width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px 14px; }
.login-form button { min-height: 44px; border: 0; border-radius: 10px; padding: 12px 16px; color: #fff; background: var(--brand); cursor: pointer; }

.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 18px; }
.workbench-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 0; }
.workbench-card { display: grid; gap: 7px; min-height: 158px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; text-align: left; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease; }
.workbench-card:hover, .workbench-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.workbench-card__title { font-weight: 700; }
.workbench-card__count { font-size: 34px; line-height: 1; }
.workbench-card__description { color: var(--text-muted); min-height: 40px; line-height: 1.5; }
.workbench-card__link { color: var(--brand); font-weight: 700; }
.workbench-card--danger { border-color: #d98d8d; background: #fff8f8; }
.workbench-card--warning { border-color: #dfc27d; background: #fffdf5; }
.workbench-card--info { border-color: #8dbbd1; background: #f7fcff; }
.workbench-card--success { border-color: #8fc4a1; background: #f7fff9; }
.workbench-issues { display: grid; gap: 11px; }
.workbench-issue { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 15px 16px; border-left: 5px solid #8dbbd1; background: #f8fbfd; border-radius: 10px; }
.workbench-issue h3 { margin: 0 0 6px; }
.workbench-issue p { margin: 0 0 5px; line-height: 1.55; }
.workbench-issue--urgent { border-left-color: #b42318; background: #fff5f4; }
.workbench-issue--high { border-left-color: #d65a31; background: #fff8f3; }
.workbench-issue--medium { border-left-color: #d5a021; background: #fffdf3; }

.patient-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; align-items: end; }
.patient-list-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 17px 18px; }
.patient-list-card__main { min-width: 0; }
.patient-list-card__title { margin: 0 0 6px; font-size: 18px; overflow-wrap: anywhere; }
.patient-list-card__meta { margin: 0; color: var(--text-muted); line-height: 1.55; }
.patient-badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 0; }
.patient-sticky-summary { position: sticky; top: 0; z-index: 4; margin: -10px -6px 18px; padding: 12px 6px; background: rgba(243,246,249,.96); backdrop-filter: blur(8px); }
.patient-tabs { margin-top: 18px; }
.patient-tab-nav { display: flex; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.patient-tab-button { white-space: nowrap; border: 0; border-radius: 9px; padding: 10px 13px; cursor: pointer; color: #436074; background: #eaf0f4; }
.patient-tab-button.is-active { color: #fff; background: var(--brand); }
.patient-tab-panel { padding: 18px 0; }
.patient-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 0 18px; }
.patient-master-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-top: 12px; background: #f9fbfc; }
.patient-edit-form { border-top: 1px solid #e5ebef; margin-top: 18px; padding-top: 18px; }
.patient-edit-form h3, .patient-edit-form .form-message { grid-column: 1 / -1; }

.dictionary-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 20px; align-items: start; }
.dictionary-sidebar, .dictionary-panel { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); }
.dictionary-selector { width: 100%; padding: 11px; border: 1px solid var(--border-strong); border-radius: 9px; }
.dictionary-summary { margin-top: 16px; display: grid; gap: 8px; color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.dictionary-item-header, .dictionary-item-row { display: grid; grid-template-columns: minmax(140px, 1.2fr) minmax(150px, 1.5fr) 80px 100px minmax(160px, 1.4fr); gap: 8px; align-items: center; padding: 9px 0; }
.dictionary-item-header { border-bottom: 2px solid var(--border); color: #536b7d; }
.dictionary-item-row { border-bottom: 1px solid #edf1f4; }
.dictionary-change-form { display: grid; gap: 12px; margin-top: 22px; }

.patient-identity-layout, .consent-admin-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); gap: 20px; align-items: start; }
.conflict-list { display: grid; gap: 14px; margin-top: 16px; }
.conflict-card, .consent-version-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #f9fbfc; margin-top: 14px; }
.consent-version-card pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; background: #fff; padding: 12px; border-radius: 8px; border: 1px solid #edf1f4; }
.hash-block { font: 12px/1.55 Consolas, monospace; color: var(--text-muted); overflow-wrap: anywhere; }
.consent-publish-form { display: grid; gap: 12px; margin-top: 16px; }
.consent-publish-form textarea { min-height: 300px; }

.template-current-card { border: 2px solid #78a9bf; }
.template-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 18px; }
.template-meta-item { min-width: 0; padding: 11px 0; border-bottom: 1px solid #edf1f4; }
.template-meta-item span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 13px; }
.template-meta-item strong { display: block; overflow-wrap: anywhere; line-height: 1.55; }
.template-sheet-list { display: grid; gap: 7px; padding-left: 24px; }
.template-sheet-list strong { color: var(--brand); font-size: 12px; }
.template-version-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(190px,auto); gap: 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid #e1e8ec; }
.template-version-row:last-child { border-bottom: 0; }
.template-version-row.is-active { background: #f6fcff; margin: 0 -12px; padding: 16px 12px; border-radius: 10px; }
.template-version-row h3 { margin: 0 0 6px; }
.template-version-row p { margin: 0 0 6px; overflow-wrap: anywhere; }
.template-version-row small { overflow-wrap: anywhere; color: var(--text-muted); }
.template-version-actions { display: grid; gap: 9px; justify-items: start; }
.import-upload-result { margin-top: 18px; border-top: 1px solid #e1e8ec; padding-top: 16px; }
.import-upload-result:empty { display: none; }

.risk-card { border-left: 5px solid #8dbbd1; }
.risk-card--high { border-left-color: #b42318; }
.risk-card--medium { border-left-color: #d56b2d; }
.risk-card--low { border-left-color: #3b829e; }
.risk-card__header { display: flex; flex-wrap: wrap; gap: 9px 14px; justify-content: space-between; align-items: flex-start; }
.risk-card__meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.risk-detail-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 12px; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(31,107,143,.3);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; max-height: none; overflow: visible; padding: 13px 14px; }
  .app-brand { padding-bottom: 10px; }
  .app-nav { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 5px; }
  .app-nav__group { display: flex; gap: 6px; flex: 0 0 auto; }
  .app-nav__heading { display: none; }
  .app-nav__item { width: auto; flex: 0 0 auto; white-space: nowrap; padding: 8px 11px; }
  .app-account { display: none; }
  .app-mobile-header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 11px; background: #fff; color: var(--text-muted); }
  .app-main { padding: 20px 15px 45px; }
  .split-layout, .patient-identity-layout, .consent-admin-layout { grid-template-columns: 1fr; }
  .patient-sticky-summary { position: static; margin: 0 0 18px; padding: 0; background: transparent; backdrop-filter: none; }
}
@media (max-width: 720px) {
  .page-header h1 { font-size: 27px; }
  .content-card, .identity-panel, .status-card, .panel { padding: 17px; border-radius: 14px; }
  .status-row { grid-template-columns: 1fr; gap: 4px; }
  .workbench-issue { grid-template-columns: 1fr; }
  .patient-list-card { grid-template-columns: 1fr; }
  .template-version-row { grid-template-columns: 1fr; }
  .dictionary-layout { grid-template-columns: 1fr; }
  .dictionary-item-header { display: none; }
  .dictionary-item-row { grid-template-columns: 1fr; }
  .filter-grid, .form-grid, .patient-form, .patient-edit-form { grid-template-columns: 1fr; }
  .route-outlet button:not(.workbench-card):not(.patient-tab-button) { width: 100%; }
  .page-actions, .actions, .toolbar { align-items: stretch; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .workbench-grid { grid-template-columns: 1fr; }
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.checkbox-field {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
.checkbox-field input { flex: 0 0 auto; margin-top: 3px; }
.checkbox-field span { min-width: 0; line-height: 1.5; }
.summary-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.summary-list li { display: grid; grid-template-columns: minmax(110px, .45fr) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf2f5; }
.summary-list li:last-child { border-bottom: 0; }
.summary-list strong { color: #40596c; }
@media (max-width: 720px) {
  .checkbox-grid { grid-template-columns: 1fr; }
  .summary-list li { grid-template-columns: 1fr; gap: 3px; }
}

/* TEST-02-15-R6：推荐依据、风险关闭证据和统一操作区 */
.recommendation-basis-panel { scroll-margin-top: 18px; }
.recommendation-basis-list { margin-top: 14px; }
.recommendation-basis-item { border-left: 4px solid var(--brand); }
.basis-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 18px;
}
.hash-value {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f1f5f7;
  color: #40596c;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.checkbox-grid .checkbox-field {
  min-height: 58px;
  align-items: flex-start;
}
.checkbox-grid .checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}
.checkbox-grid .checkbox-field span {
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}
.content-card > .page-actions:last-child,
.content-card > .form-grid:last-child { margin-top: 14px; }
@media (max-width: 720px) {
  .basis-detail-grid { grid-template-columns: 1fr; }
  .recommendation-basis-item { border-left-width: 3px; }
}


/* TEST-02-15 R7 Web页面真实验收收口 */
.status-banner:empty { display: none; }
.audit-metric-row { grid-template-columns: minmax(150px, 1fr) minmax(72px, auto); align-items: center; }
.audit-metric-row .status-row__label { overflow-wrap: anywhere; }
.audit-metric-row .status-row__value { text-align: right; white-space: nowrap; }
.ai-config-form { display: grid; gap: 18px; }
.ai-config-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ai-config-field--wide { grid-column: span 2; }
.ai-config-field--full { grid-column: 1 / -1; }
.ai-config-actions { display: grid; grid-template-columns: auto auto minmax(220px, 1fr); gap: 10px; align-items: center; padding-top: 16px; border-top: 1px solid var(--border); }
.ai-config-result { margin: 0; min-width: 0; color: var(--text-muted); overflow-wrap: anywhere; }
.patient-create-form { display: grid; grid-template-columns: 1fr; gap: 16px; }
.patient-form-section { border: 1px solid var(--border); border-radius: 13px; padding: 16px; background: var(--surface-soft); }
.patient-form-section .section-heading { margin-bottom: 12px; }
.patient-form-section .section-heading p { font-size: 13px; }
.patient-form-section__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.patient-form-action { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; margin: 2px -6px -6px; padding: 13px 6px 6px; background: linear-gradient(to top, #fff 76%, rgba(255,255,255,.85)); }
.patient-form-action__message { margin: 0; }
.field-invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(165,42,34,.12); }
.quality-rule-grid .metric-card small { color: var(--text-muted); line-height: 1.5; }
.redemption-create-action { grid-column: 1 / -1; justify-self: start; min-width: 180px; }
.filter-grid .form-field:has(input[placeholder*="编号"]) { min-width: min(100%, 270px); }
@media (max-width: 1050px) {
  .ai-config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-config-field--wide, .ai-config-field--full { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .audit-metric-row { grid-template-columns: 1fr; }
  .audit-metric-row .status-row__value { text-align: left; white-space: normal; }
  .ai-config-grid, .patient-form-section__grid { grid-template-columns: 1fr; }
  .ai-config-actions, .patient-form-action { grid-template-columns: 1fr; position: static; }
}

/* R9 health education workbench */
.education-workbench { --education-accent: #2b7d8f; }
.education-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
  gap: 18px;
  align-items: start;
}
.education-editor { padding-bottom: 12px; }
.education-editor-form { display: grid; gap: 18px; }
.education-section {
  display: grid;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.education-section h3 { margin: 0; font-size: 18px; }
.education-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
}
.education-check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
.education-check-option input { width: 17px; height: 17px; }
.education-sticky-actions {
  position: sticky;
  bottom: 10px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(9px);
}
.education-ai-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 13px;
  border-color: #a8cedb;
  background: linear-gradient(180deg, #f5fbfd 0%, #ffffff 42%);
}
.education-ai-panel h2 { margin-bottom: 0; }
.education-ai-form { display: grid; gap: 12px; }
.education-findings { display: grid; gap: 8px; }
.education-finding {
  border-left: 4px solid #7da9bc;
  border-radius: 8px;
  padding: 10px 11px;
  background: #f5fafc;
  line-height: 1.55;
}
.education-finding--success { border-left-color: var(--success); background: var(--success-bg); color: var(--success); }
.education-finding--warning { border-left-color: #c89116; background: var(--warning-bg); color: var(--warning); }
.education-finding--danger { border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.education-preview-panel { overflow: hidden; }
.education-preview {
  width: min(780px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid #cfe0e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(34,78,101,.08);
}
.education-preview h2 { margin: 5px 0 9px; font-size: clamp(25px, 3vw, 34px); }
.education-preview h3 { margin: 24px 0 8px; font-size: 19px; }
.education-preview p { margin: 8px 0; line-height: 1.8; }
.education-preview__summary { font-size: 17px; color: #496579; }
.education-preview__step { padding: 10px 12px; border-radius: 10px; background: #f6fafc; }
.education-contact-box, .education-reference-box, .education-disclaimer {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 11px;
  line-height: 1.7;
}
.education-contact-box { border: 1px solid #e8c783; background: #fffbef; color: #6c4c08; }
.education-reference-box { border: 1px solid var(--border); background: #f7fafc; }
.education-reference-box p { margin: 6px 0; font-size: 14px; }
.education-disclaimer { border: 1px solid #b6d6c4; background: var(--success-bg); color: #245d42; }
.education-list { display: grid; gap: 12px; }
.education-list-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
}
.education-list-card__main { min-width: 0; }
.education-list-card__main h3 { margin: 0; overflow-wrap: anywhere; }
.education-list-card__actions { display: grid; gap: 8px; }
.education-tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.education-tag { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 9px; border-radius: 999px; background: #edf5f8; color: #315d70; font-size: 12px; }
.education-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.education-history-column { display: grid; gap: 10px; align-content: start; }
.education-history-item, .education-event-item {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}
.education-history-item summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.education-event-item { display: grid; gap: 4px; }

@media (max-width: 1080px) {
  .education-workspace { grid-template-columns: 1fr; }
  .education-ai-panel { position: static; }
}
@media (max-width: 720px) {
  .education-check-grid, .education-history-grid { grid-template-columns: 1fr; }
  .education-list-card { grid-template-columns: 1fr; }
  .education-sticky-actions { position: static; }
}

/* R10 controlled rich text, media assets and role-aware education workbench */
.role-guidance-card { display: grid; gap: 8px; border-left: 5px solid #7da9bc; }
.role-guidance-card p { margin: 0; color: var(--text-muted); }
.role-guidance-card.is-professional { border-left-color: var(--success); background: linear-gradient(90deg, #f2fbf6, #fff); }
.role-guidance-card.is-supervisor { border-left-color: #c58b1d; background: linear-gradient(90deg, #fff9eb, #fff); }
.role-guidance-card .secondary-button { justify-self: start; }
.controlled-rich-editor { display: grid; gap: 0; border: 1px solid var(--border-strong); border-radius: 13px; background: #fff; overflow: hidden; }
.controlled-rich-editor.is-disabled { background: #f6f8fa; }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 9px; border-bottom: 1px solid var(--border); background: #f5f8fa; }
.rich-toolbar__button, .rich-toolbar__select { min-height: 34px; border: 1px solid #c8d6de; border-radius: 8px; background: #fff; color: var(--text); padding: 5px 9px; font-size: 13px; }
.rich-toolbar__button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.rich-editor-surface { min-height: 380px; padding: 20px; outline: none; line-height: 1.8; font-size: 16px; color: #263f4c; overflow-wrap: anywhere; }
.rich-editor-surface:empty::before { content: attr(data-placeholder); color: #8195a3; pointer-events: none; }
.rich-editor-surface h2 { margin: 26px 0 10px; font-size: 26px; }
.rich-editor-surface h3 { margin: 22px 0 9px; font-size: 21px; }
.rich-editor-surface p { margin: 8px 0; }
.rich-editor-surface blockquote { margin: 14px 0; padding: 12px 16px; border-left: 4px solid #7ca9bd; background: #f3f8fb; }
.rich-editor-footer { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); background: #fafcfd; font-size: 13px; }
.education-callout { margin: 16px 0; padding: 14px 16px; border-radius: 11px; border-left: 5px solid #5d93aa; background: #f2f8fb; }
.education-callout--info { border-left-color: #4e8eaa; background: #edf8fc; }
.education-callout--steps { border-left-color: #3f9271; background: #eef9f3; }
.education-callout--warning { border-left-color: #c28b20; background: #fff8e9; }
.education-callout--danger { border-left-color: #b34f45; background: #fff1ef; }
.education-media { margin: 18px auto; text-align: center; }
.education-media img { max-width: 100%; height: auto; border-radius: 12px; box-shadow: 0 8px 22px rgba(31,63,82,.12); }
.education-media--small { max-width: 320px; }
.education-media--medium { max-width: 560px; }
.education-media--large { max-width: 860px; }
.education-media figcaption { margin-top: 7px; color: var(--text-muted); font-size: 13px; }
.source-editor { display: grid; gap: 10px; }
.source-editor__rows { display: grid; gap: 10px; }
.source-row { display: grid; grid-template-columns: 1.3fr 1fr 150px 140px 1.3fr 1.1fr auto auto; gap: 8px; align-items: center; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.source-row input, .source-row select { min-width: 0; }
.source-row__verified { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.source-row__verified input { width: 17px; height: 17px; }
.education-save-state { margin-right: auto; align-self: center; }
.education-save-state.is-dirty { color: #9a6500; font-weight: 700; }
.education-save-state.is-saved { color: var(--success); }
.education-save-state.is-error { color: var(--danger); }
.education-ai-diff { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.education-ai-diff h3 { margin: 0; }
.education-ai-diff__grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.education-ai-diff__column { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.education-ai-diff__body { max-height: 250px; overflow: auto; white-space: pre-wrap; line-height: 1.65; margin-top: 9px; padding: 10px; background: #f7fafc; border-radius: 8px; }
.education-ai-diff__actions { display: flex; flex-wrap: wrap; gap: 7px; }
.education-ai-paragraphs summary { cursor: pointer; color: var(--brand); font-weight: 700; }
.education-ai-paragraph { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.education-preview.is-mobile { width: min(390px, 100%); padding: 22px 18px; }
.education-rich-readonly { margin-top: 18px; line-height: 1.8; }
.education-rich-readonly img { max-width: 100%; height: auto; border-radius: 12px; }
.education-supervisor-detail { border-left: 5px solid #c58b1d; }
@media (max-width: 1380px) {
  .source-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .source-row__verified { min-height: 40px; }
}
@media (max-width: 720px) {
  .rich-toolbar { overflow-x: auto; flex-wrap: nowrap; }
  .rich-editor-surface { min-height: 300px; padding: 15px; }
  .source-row, .education-ai-diff__grid, .education-ai-paragraph { grid-template-columns: 1fr; }
  .education-save-state { width: 100%; }
}
.rich-tool-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #f8fbfc;
}
.rich-tool-panel[hidden] { display: none !important; }
.rich-tool-panel__title { margin: 0; font-size: 16px; }
.rich-tool-panel__body { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.rich-tool-field { display: grid; gap: 6px; min-width: 0; }
.rich-tool-field > span { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.rich-tool-field--full { grid-column: 1 / -1; }
.rich-tool-panel__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.rich-editor-status { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
.education-recovery-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.education-recovery-banner > span { flex: 1 1 300px; }
@media (max-width: 720px) {
  .rich-tool-panel__body { grid-template-columns: 1fr; }
  .rich-tool-field--full { grid-column: auto; }
  .rich-tool-panel__actions { justify-content: stretch; }
  .rich-tool-panel__actions button { flex: 1; }
}

/* R11-HF2：患者管理、建档与匹配统一工作台 */
.patient-hub-header { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.patient-hub-header > .eyebrow,
.patient-hub-header > h1,
.patient-hub-header > p { grid-column: 1; }
.patient-hub-actions { grid-column: 2; grid-row: 1 / span 3; align-self: end; justify-content: flex-end; }
.patient-hub-tabs { margin-top: 0; }
.patient-hub-panel { min-height: 220px; }
.patient-hub-panel > .identity-panel { box-shadow: none; }
.patient-list-card__actions { display: grid; gap: 8px; min-width: 118px; }
.patient-list-empty { display: grid; justify-items: start; gap: 12px; }
.patient-create-result-host:empty { display: none; }
.patient-create-result { display: grid; gap: 14px; margin-bottom: 16px; padding: 18px; }
.patient-create-result h3 { margin: 0; }
.patient-create-result__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.patient-create-result__item { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid rgba(43, 125, 143, .18); border-radius: 10px; background: rgba(255,255,255,.75); }
.patient-create-result__item span { color: var(--text-muted); font-size: 13px; }
.patient-create-result__item strong { overflow-wrap: anywhere; }
.patient-create-result__actions { margin-top: 2px; }
.patient-create-conflict-action { width: auto !important; margin-left: 6px; padding: 5px 9px; }
.patient-identity-compat { margin-top: 0; }
@media (max-width: 900px) {
  .patient-hub-header { grid-template-columns: 1fr; }
  .patient-hub-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .patient-list-card__actions { width: 100%; grid-template-columns: 1fr; }
  .patient-create-result__grid { grid-template-columns: 1fr; }
}

.required-marker {
  color: #b42318;
  font-weight: 800;
}

/* R11-HF3.5 patient and cycle workflow clarity */
.required-mark { color: #b42318; font-weight: 800; }
.patient-back-button {
  width: auto;
  justify-self: start;
  align-self: start;
  padding-inline: 16px;
  margin-top: 4px;
}
.cycle-record-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid #dbe5eb;
  border-radius: 12px;
  background: #fbfdfe;
}
.cycle-record-card + .cycle-record-card { margin-top: 12px; }
.cycle-record-card__summary { display: grid; gap: 6px; }
.cycle-record-card__actions { justify-content: flex-end; }
.cycle-editor-host { margin-bottom: 18px; }
.cycle-clinical-editor { display: grid; gap: 16px; }
.cycle-editor-nav { position: sticky; top: 92px; z-index: 3; padding: 10px; border: 1px solid #dbe5eb; border-radius: 10px; background: rgba(255,255,255,.96); }
.cycle-editor-section { scroll-margin-top: 150px; }
.form-message.is-error { color: #b42318; }
.form-message.is-success { color: #067647; }

@media (max-width: 900px) {
  .cycle-record-card { grid-template-columns: 1fr; }
  .cycle-record-card__actions { justify-content: flex-start; }
  .cycle-editor-nav { position: static; }
}

/* R11-HF3.5.3：推荐版本选择、可读内容、差异比较与移动端操作层级 */
.page-header__back { justify-self: start; width: auto !important; min-width: 132px; }
.recommendation-primary-actions .primary-button { font-weight: 800; box-shadow: 0 8px 20px rgba(23,107,143,.22); }
.recommendation-version-chooser { margin-top: 14px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.recommendation-basis-disclosure { margin-top: 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.recommendation-basis-disclosure > summary { padding: 13px 15px; cursor: pointer; color: var(--brand); font-weight: 800; }
.recommendation-basis-disclosure__body { padding: 0 15px 15px; }
.recommendation-readable-content { display: grid; gap: 14px; }
.recommendation-content-section { padding: 14px 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.recommendation-content-section h3 { margin: 0 0 10px; color: var(--brand-dark); }
.recommendation-content-section--safety { border-color: #e2c66f; background: #fffaf0; }
.recommendation-readable-list { display: grid; gap: 8px; margin: 0; padding-left: 24px; line-height: 1.65; }
.recommendation-diff-list { display: grid; gap: 12px; padding: 12px; }
.recommendation-diff-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.recommendation-diff-row > .section-heading { grid-column: 1 / -1; }
.recommendation-diff-cell { min-width: 0; padding: 10px; border-radius: 8px; background: var(--surface-soft); }
.recommendation-diff-cell p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.recommendation-diff-disclosure { margin-top: 10px; }
@media (max-width: 720px) {
  .page-header__back { width: auto !important; }
  .recommendation-diff-row { grid-template-columns: 1fr; }
  .recommendation-diff-row > .section-heading { grid-column: 1; }
}
