:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --ink: #14212b;
  --muted: #657684;
  --line: #dbe5eb;
  --line-strong: #c6d4dd;
  --blue: #146fb3;
  --blue-dark: #0d5389;
  --teal: #0b8f82;
  --teal-dark: #076e66;
  --amber: #b7791f;
  --amber-dark: #8b5a13;
  --red: #b3261e;
  --green: #117a5f;
  --sidebar: #08263b;
  --sidebar-2: #0c354f;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 35, 50, 0.05);
  --shadow: 0 1px 2px rgba(15, 35, 50, 0.04), 0 10px 24px rgba(15, 35, 50, 0.07);
  --ring: 0 0 0 3px rgba(20, 111, 179, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(20, 111, 179, 0.16);
}

a {
  color: var(--blue);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

:is(a, button, input, select, textarea):focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  font-weight: 760;
  line-height: 1.18;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 730;
  line-height: 1.25;
}

h3 {
  font-size: 15px;
}

.mobile-label {
  display: none;
}

/* App frame */

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  isolation: isolate;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  overflow: hidden;
  color: #dcebf4;
  background: linear-gradient(180deg, var(--sidebar) 0%, #061d2e 62%, #0b3a44 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar::after {
  content: "";
  position: absolute;
  left: -18px;
  right: -10px;
  bottom: 128px;
  z-index: 0;
  height: 142px;
  background: rgba(239, 247, 250, 0.36);
  mask-image: url("brand/ruijin-8-lineart-mask.png");
  mask-repeat: no-repeat;
  mask-position: left bottom;
  mask-size: 292px auto;
  -webkit-mask-image: url("brand/ruijin-8-lineart-mask.png");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: left bottom;
  -webkit-mask-size: 292px auto;
  pointer-events: none;
}

.sidebar-top,
.sidebar-study,
.nav-links,
.sidebar-footer {
  position: relative;
  z-index: 1;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  color: #fff;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.brand small {
  margin-top: 2px;
  color: rgba(220, 235, 244, 0.78);
  font-size: 12px;
}

/* Mobile nav toggle (hamburger) — hidden on desktop, revealed in mobile media query */
.nav-toggle-cb {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar-top .brand {
  flex: 1;
  min-width: 0;
}

.mobile-logout {
  display: none;
}

.nav-toggle {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-right: -6px;
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.09);
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #dcebf4;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav-toggle span {
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle span::before {
  top: -6px;
}

.nav-toggle span::after {
  top: 6px;
}

.nav-toggle-cb:checked ~ .sidebar-top .nav-toggle span {
  background: transparent;
}

.nav-toggle-cb:checked ~ .sidebar-top .nav-toggle span::before {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle-cb:checked ~ .sidebar-top .nav-toggle span::after {
  transform: translateY(-6px) rotate(-45deg);
}

.sidebar-study {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-study span,
.sidebar-study small {
  display: block;
  color: rgba(220, 235, 244, 0.74);
  font-size: 12px;
}

.sidebar-study strong {
  display: block;
  margin: 4px 0;
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.nav-links {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.nav-links a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: rgba(239, 247, 250, 0.82);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 680;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.nav-links a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(20, 111, 179, 0.9), rgba(11, 143, 130, 0.84));
}

.nav-section {
  margin: 16px 12px 4px;
  color: rgba(220, 235, 244, 0.54);
  font-size: 12px;
  font-weight: 760;
}

.sidebar-footer {
  padding: 14px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer img {
  display: block;
  width: 100%;
  max-height: 62px;
  object-fit: contain;
  object-position: left center;
}

.workspace {
  position: relative;
  isolation: isolate;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.workspace::before {
  content: "";
  position: absolute;
  inset: 66px 0 0;
  z-index: 0;
  background-image: url("brand/ruijin-motto-stone.jpg");
  background-repeat: repeat-x;
  background-position: center center;
  background-size: auto 100%;
  opacity: 0.05;
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 66px;
  padding: 12px 30px;
  background: #fff;
  border-bottom: 1px solid rgba(219, 229, 235, 0.86);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
}

.topbar-title {
  min-width: 0;
}

.topbar-title span,
.topbar-title strong {
  display: block;
}

.topbar-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.06em;
}

.topbar-title strong {
  max-width: 860px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.user-menu,
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-menu {
  justify-content: flex-end;
}

.user-menu a {
  color: #344854;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 680;
}

.user-menu a:hover {
  background: #eef5f9;
}

.system-dot,
.status-chip,
.role-pill,
.arm-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17, 122, 95, 0.22);
  color: var(--green);
  background: #e6f5ef;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.system-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
}

.role-pill.danger {
  border-color: rgba(179, 38, 30, 0.22);
  color: var(--red);
  background: #fbe9e7;
}

.role-pill.neutral {
  border-color: rgba(82, 101, 114, 0.2);
  color: var(--muted);
  background: #eef3f6;
}

.status-badge.done {
  border-color: rgba(17, 122, 95, 0.22);
  color: var(--green);
  background: #e6f5ef;
}

.status-badge.pending {
  border-color: rgba(183, 121, 31, 0.3);
  color: #7a4f10;
  background: #fff1d8;
}

/* Page */

.page {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 52px;
  flex: 1;
}

.footer {
  padding: 22px 30px 28px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 4px 0 22px;
}

.dashboard-head {
  align-items: center;
}

.dashboard-page {
  position: relative;
  isolation: isolate;
  --dashboard-stack-height: 735px;
  --dashboard-recent-height: 184px;
}

.dashboard-page > * {
  position: relative;
  z-index: 1;
}

/* App motion */

.app-body .sidebar {
  animation: shellSidebarIn 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-body .topbar {
  animation: shellTopbarIn 0.44s 0.04s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-body .page > :where(section, div.panel, form.panel, div.actions, div.pager, div.dashboard-page) {
  animation: pageBlockIn 0.46s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-body .page > :nth-child(2) {
  animation-delay: 0.05s;
}

.app-body .page > :nth-child(3) {
  animation-delay: 0.1s;
}

.app-body .page > :nth-child(4) {
  animation-delay: 0.15s;
}

.app-body .page > :nth-child(5) {
  animation-delay: 0.2s;
}

.app-body :where(.two-col, .three-col, .form-workspace, .center-admin-grid, .user-admin-grid, .side-stack, .dashboard-side) > :where(.panel, form.panel, aside) {
  animation: surfaceRiseIn 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-body :where(.two-col, .three-col, .form-workspace, .center-admin-grid, .user-admin-grid, .side-stack, .dashboard-side) > :nth-child(2) {
  animation-delay: 0.08s;
}

.app-body :where(.two-col, .three-col, .form-workspace, .center-admin-grid, .user-admin-grid, .side-stack, .dashboard-side) > :nth-child(3) {
  animation-delay: 0.14s;
}

.app-body :where(.two-col, .three-col, .form-workspace, .center-admin-grid, .user-admin-grid, .side-stack, .dashboard-side) > :nth-child(4) {
  animation-delay: 0.2s;
}

.app-body .form-panel > :where(.form-section, .form-grid, .warning-strip, .actions),
.app-body .detail-list > *,
.app-body .mini-stats > *,
.app-body .admin-row,
.app-body .flash {
  animation: detailFadeIn 0.34s ease both;
}

.app-body .form-panel > :nth-child(3),
.app-body .detail-list > :nth-child(n + 3),
.app-body .mini-stats > :nth-child(n + 3) {
  animation-delay: 0.04s;
}

.app-body .form-panel > :nth-child(4),
.app-body .detail-list > :nth-child(n + 5),
.app-body .mini-stats > :nth-child(n + 5) {
  animation-delay: 0.08s;
}

.app-body .form-panel > :nth-child(5),
.app-body .detail-list > :nth-child(n + 7),
.app-body .mini-stats > :nth-child(n + 7) {
  animation-delay: 0.12s;
}

.app-body :where(.patients-table, .center-list-panel table, .user-list-panel table, .balance-table) tbody tr,
.app-body .audit-table tbody.audit-entry,
.app-body :where(.record, .mobile-center-card, .mobile-user-card) {
  animation: tableRowIn 0.34s ease both;
}

.app-body :where(.patients-table, .center-list-panel table, .user-list-panel table, .balance-table) tbody tr:nth-child(2),
.app-body .audit-table tbody.audit-entry:nth-of-type(2),
.app-body :where(.record, .mobile-center-card, .mobile-user-card):nth-child(2) {
  animation-delay: 0.03s;
}

.app-body :where(.patients-table, .center-list-panel table, .user-list-panel table, .balance-table) tbody tr:nth-child(3),
.app-body .audit-table tbody.audit-entry:nth-of-type(3),
.app-body :where(.record, .mobile-center-card, .mobile-user-card):nth-child(3) {
  animation-delay: 0.06s;
}

.app-body :where(.patients-table, .center-list-panel table, .user-list-panel table, .balance-table) tbody tr:nth-child(4),
.app-body .audit-table tbody.audit-entry:nth-of-type(4),
.app-body :where(.record, .mobile-center-card, .mobile-user-card):nth-child(4) {
  animation-delay: 0.09s;
}

.app-body :where(.patients-table, .center-list-panel table, .user-list-panel table, .balance-table) tbody tr:nth-child(5),
.app-body .audit-table tbody.audit-entry:nth-of-type(5),
.app-body :where(.record, .mobile-center-card, .mobile-user-card):nth-child(5) {
  animation-delay: 0.12s;
}

.app-body :where(.patients-table, .center-list-panel table, .user-list-panel table, .balance-table) tbody tr:nth-child(n + 6),
.app-body .audit-table tbody.audit-entry:nth-of-type(n + 6),
.app-body :where(.record, .mobile-center-card, .mobile-user-card):nth-child(n + 6) {
  animation-delay: 0.15s;
}

.app-body .progress i {
  transform-origin: left center;
  animation: progressBarGrow 0.86s 0.16s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-body .metric,
.app-body .record,
.app-body :where(.mobile-center-card, .mobile-user-card) {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.app-body .metric:hover,
.app-body .record:hover,
.app-body :where(.mobile-center-card, .mobile-user-card):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.page-index .dashboard-page::after {
  content: "";
  top: -8px;
  right: -18px;
  position: absolute;
  z-index: 0;
  width: min(430px, 42vw);
  height: 152px;
  background-image:
    linear-gradient(90deg, rgba(20, 111, 179, 0.16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(11, 143, 130, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 28%, #000 72%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28%, #000 72%, transparent);
  opacity: 0.3;
  animation: consoleGridDrift 15s linear infinite;
  pointer-events: none;
}

.page-index .dashboard-head h1 {
  position: relative;
  width: fit-content;
}

.page-index .dashboard-head h1::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 0;
  bottom: -8px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--teal), rgba(183, 121, 31, 0.68));
  transform: scaleX(0);
  transform-origin: left;
  animation: consoleTitleRule 0.82s 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.app-body .system-dot::before {
  animation: systemPulse 2.4s ease-in-out infinite;
}

.page-index .metric {
  animation: consoleMetricIn 0.58s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.page-index .metric:nth-child(2) {
  animation-delay: 0.08s;
}

.page-index .metric:nth-child(3) {
  animation-delay: 0.16s;
}

.page-index .metric:nth-child(4) {
  animation-delay: 0.24s;
}

.page-index .metric > * {
  position: relative;
  z-index: 1;
}

.page-index .metric::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -70%;
  z-index: 0;
  width: 56%;
  background: linear-gradient(105deg, transparent 0 30%, rgba(255, 255, 255, 0.56) 50%, transparent 70% 100%);
  transform: translateX(-90%) skewX(-18deg);
  animation: consoleCardSheen 6.6s ease-in-out infinite;
  pointer-events: none;
}

.page-index .metric:nth-child(2)::after {
  animation-delay: 0.45s;
}

.page-index .metric:nth-child(3)::after {
  animation-delay: 0.9s;
}

.page-index .metric:nth-child(4)::after {
  animation-delay: 1.35s;
}

.page-index .metric strong {
  animation: metricNumberPop 0.62s 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.page-index .overall-balance-pill strong,
.page-index .balance-score-watch,
.page-index .balance-score-poor {
  animation: balanceSignal 2.6s ease-in-out infinite;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-note {
  margin: 8px 0 0;
  max-width: 720px;
  color: var(--muted);
}

.subhead {
  margin: 24px 0 10px;
  color: #30424f;
  font-size: 14px;
  font-weight: 760;
}

.balance-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.balance-panel-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.panel-head .overall-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid rgba(17, 122, 95, 0.2);
  border-radius: 6px;
  color: var(--teal-dark);
  background: #e6f5ef;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.overall-balance-pill strong {
  color: var(--green);
  font-weight: 840;
  font-variant-numeric: tabular-nums;
}

.factor-weight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid rgba(20, 111, 179, 0.18);
  border-radius: 6px;
  color: var(--blue);
  background: #e8f2fb;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.muted,
.panel-head span,
.metric em {
  color: var(--muted);
  font-style: normal;
}

/* Surfaces */

.panel,
.metric,
.login-panel,
.allocation-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head a {
  font-size: 14px;
  font-weight: 740;
}

.notice-strip,
.warning-strip,
.locked-panel {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 13px 15px;
  border: 1px solid #e8c88d;
  border-left: 4px solid #d99b2b;
  border-radius: var(--radius);
  color: #6e4300;
  background: #fff8e8;
}

.notice-strip {
  margin-bottom: 18px;
}

.notice-strip strong {
  flex: 0 0 auto;
}

.locked-panel {
  justify-content: space-between;
  margin-bottom: 18px;
}

.danger-zone {
  border-color: #efb9b4;
}

.danger-zone p {
  color: #743127;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.flash.success {
  color: #0c5f4f;
  border-color: #acd9cf;
  border-left-color: #159a7e;
  background: #eaf8f4;
}

.flash.danger {
  color: #8a2118;
  border-color: #f0b9b4;
  border-left-color: #c5392f;
  background: #fef1ef;
}

.flash.warning {
  color: #684100;
  border-color: #f0d094;
  border-left-color: #d9a13c;
  background: #fff7e6;
}

.flash.info {
  color: #184d72;
  border-color: #bdd7ea;
  border-left-color: #3583c0;
  background: #eef7fe;
}

/* Metrics */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
}

.metric-teal::before {
  background: var(--teal);
}

.metric-amber::before {
  background: var(--amber);
}

.metric-slate::before {
  background: #6a7d8b;
}

.metric-label,
.metric span,
.metric em {
  display: block;
  font-size: 13px;
}

.metric-label {
  color: var(--muted);
  font-weight: 720;
}

.metric strong {
  display: block;
  margin: 11px 0;
  font-size: 30px;
  font-weight: 780;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3eaef;
  box-shadow: inset 0 1px 2px rgba(15, 35, 50, 0.08);
}

.progress.large {
  height: 10px;
  margin-bottom: 18px;
}

.progress i {
  display: block;
  max-width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-dark), #13aa98);
}

/* Layout grids */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.72fr);
  gap: 18px;
  align-items: stretch;
}

.patient-detail-grid {
  grid-template-columns: minmax(0, 0.4fr) minmax(0, 0.6fr);
  align-items: stretch;
}

.patient-detail-grid > .panel {
  height: 100%;
}

.dashboard-side {
  display: grid;
  grid-template-rows: var(--dashboard-recent-height) minmax(0, 1fr);
  gap: 18px;
  height: var(--dashboard-stack-height);
  min-height: 0;
}

.balance-panel {
  height: var(--dashboard-stack-height);
  overflow-y: auto;
}

.activity-panel,
.pending-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.activity-panel .record-list,
.pending-panel .record-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.center-admin-grid,
.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(340px, 1.14fr);
  gap: 18px;
  align-items: start;
}

.center-admin-grid > *,
.user-admin-grid > * {
  min-width: 0;
}

.center-list-panel,
.user-list-panel {
  grid-column: 1 / -1;
}

.center-ops-grid,
.user-ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.center-ops-grid form,
.user-ops-grid form {
  display: block;
}

.center-ops-grid > a,
.user-ops-grid > a {
  grid-column: 1 / -1;
}

.center-ops-grid > *,
.user-ops-grid > * {
  min-width: 0;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.narrow {
  width: min(560px, 100%);
  margin: 28px auto;
}

.form-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.center-list-panel table,
.user-list-panel table {
  min-width: 900px;
}

.mobile-center-list,
.mobile-user-list {
  display: none;
}

/* Tables */

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.table-wrap.compact {
  box-shadow: none;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

.audit-table {
  min-width: 860px;
  table-layout: fixed;
}

.audit-col-time {
  width: 19%;
}

.audit-col-action {
  width: 20%;
}

.audit-col-actor {
  width: 12%;
}

.audit-col-target {
  width: 24%;
}

.audit-col-ip {
  width: 14%;
}

.audit-col-result {
  width: 11%;
}

.compact table {
  min-width: 560px;
}

.balance-table {
  min-width: 720px;
  table-layout: fixed;
}

.balance-col-level {
  width: 42%;
}

.balance-col-number,
.balance-col-arm,
.balance-col-total,
.balance-col-diff {
  width: 10%;
}

.balance-col-score {
  width: 18%;
}

.balance-table th:not(:first-child),
.balance-table td:not(:first-child) {
  text-align: center;
}

.balance-table th small {
  color: #718290;
  font-size: 11px;
  font-weight: 700;
}

.factor-name {
  color: var(--ink);
  font-weight: 780;
}

.balance-score {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.balance-score-good {
  color: var(--green);
}

.balance-score-watch {
  color: var(--amber-dark);
}

.balance-score-poor {
  color: var(--red);
}

th,
td {
  padding: 11px 13px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #e7eef3;
}

th {
  color: #526572;
  background: #f6f9fb;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

td {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover td {
  background: #f8fbfc;
}

tr:last-child td {
  border-bottom: 0;
}

code {
  padding: 2px 6px;
  border-radius: 5px;
  color: #0f5661;
  background: #e6f2f3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.empty.large {
  padding: 38px 16px;
}

.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
}

.row-actions form {
  display: inline-flex;
}

/* Records */

.record-list {
  display: grid;
  gap: 8px;
}

.record {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfdfe;
  transition: border-color 0.16s ease;
}

.record:hover {
  border-color: var(--line-strong);
}

.record small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.record b,
td b {
  font-variant-numeric: tabular-nums;
}

.record-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid rgba(17, 122, 95, 0.22);
  border-radius: 7px;
  color: var(--green);
  background: #e6f5ef;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.pending-record-list {
  align-content: start;
  grid-auto-rows: 96px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.pending-record {
  height: 96px;
  min-height: 96px;
}

.pending-record > span:first-child {
  min-width: 0;
}

.pending-record small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-record .record-action {
  flex: 0 0 auto;
}

.arm-ip,
.arm-soc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 3px 8px;
  border-radius: 7px;
  font-weight: 780;
}

.arm-ip {
  border: 1px solid rgba(11, 143, 130, 0.28);
  color: #075f58;
  background: #ddf3ee;
}

.arm-soc {
  border: 1px solid rgba(183, 121, 31, 0.3);
  color: #7a4f10;
  background: #fff1d8;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 740;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:hover {
  border-color: #adbfca;
  background: #f8fbfc;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn.primary {
  color: #fff;
  border-color: var(--blue-dark);
  background: linear-gradient(180deg, #1879bf, var(--blue));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.17), 0 4px 12px rgba(13, 83, 137, 0.24);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #146fb3, var(--blue-dark));
}

.btn.ghost {
  background: #fff;
}

.btn.danger {
  color: #fff;
  border-color: #9a1f18;
  background: linear-gradient(180deg, #c23a31, var(--red));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 4px 12px rgba(179, 38, 30, 0.22);
}

.btn.danger:hover {
  background: linear-gradient(180deg, #b02c24, #9a1f18);
}

.btn.small {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.btn.full {
  width: 100%;
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.table-action,
.link-danger {
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-weight: 740;
  border-radius: 4px;
}

.table-action:hover,
.link-danger:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-danger {
  color: var(--red);
}

/* Forms */

label {
  display: block;
  color: #354854;
  font-size: 14px;
  font-weight: 680;
}

label span {
  color: var(--red);
}

label > input,
label > select,
label > textarea {
  margin-top: 7px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  border: 1px solid #cbd9e1;
  border-radius: var(--radius);
  background: #fff;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #adbfca;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: var(--ring);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23657684' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
  box-shadow: none;
  cursor: pointer;
}

.panel form,
form.panel {
  display: grid;
  gap: 16px;
}

.form-panel {
  display: grid;
  gap: 20px;
}

.form-section {
  display: grid;
  gap: 14px;
}

.section-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.section-head > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--blue-dark);
  background: #eaf4fb;
  font-size: 13px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.confirm-head {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
}

.confirm-head > span {
  align-self: start;
}

.confirm-head .btn {
  justify-self: end;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.check-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.check-panel label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-weight: 650;
  cursor: pointer;
}

.status-panel .panel-head {
  margin-bottom: 14px;
}

.mini-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px 12px;
  margin: 0;
}

.mini-stats dt {
  color: var(--muted);
  font-weight: 680;
}

.mini-stats dd {
  margin: 0;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

/* Login */

.login-body {
  min-height: 100vh;
  background: #071625;
}

.login-body .page {
  width: 100%;
  min-height: 100vh;
  display: block;
  padding: 0;
  overflow: hidden;
}

.login-body .flash-stack {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 40;
  width: min(480px, calc(100% - 32px));
  margin: 0;
  transform: translateX(-50%);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: #071625;
}

.login-hero {
  --login-left-offset: 70px;
  position: relative;
  display: grid;
  align-content: start;
  gap: 28px;
  min-height: 100vh;
  padding: clamp(36px, 6vw, 76px) clamp(42px, 7vw, 96px) 44px;
  overflow: hidden;
  color: #fff;
}

.login-photo,
.login-hero-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-photo {
  z-index: 0;
  background-image: url("brand/ruijin-campus-night.jpg");
  background-position: center;
  background-size: cover;
  filter: saturate(0.98) contrast(1.08);
  transform: scale(1.04);
  animation: loginPhotoDrift 18s ease-in-out infinite alternate;
}

.login-hero-shade {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(4, 17, 28, 0.92) 0%, rgba(5, 30, 49, 0.78) 45%, rgba(8, 34, 47, 0.28) 100%),
    linear-gradient(180deg, rgba(9, 18, 27, 0.26) 0%, rgba(9, 18, 27, 0.64) 100%);
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: -20% 0;
  z-index: 1;
  background: linear-gradient(115deg, transparent 0 42%, rgba(255, 255, 255, 0.12) 50%, transparent 58%);
  opacity: 0.34;
  transform: translateX(-78%);
  animation: loginSheen 8s ease-in-out infinite;
  pointer-events: none;
}

.login-brand-row {
  position: relative;
  z-index: 2;
  display: inline-flex;
  width: fit-content;
}

.login-lockup {
  width: min(500px, 52vw);
  height: auto;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 13px 26px rgba(0, 0, 0, 0.34));
}

.login-copy {
  position: relative;
  z-index: 2;
  max-width: 760px;
  padding-top: min(8vh, 72px);
  transform: translateY(var(--login-left-offset));
  animation: loginReveal 0.72s ease both;
}

.login-copy h1 {
  position: relative;
  margin: 10px 0 16px;
  color: #fff;
  font-size: 58px;
  line-height: 1.14;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.38);
}

.login-copy h1::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -8px;
  width: min(320px, 48%);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(244, 199, 119, 0.78), rgba(191, 233, 226, 0));
  transform: scaleX(0);
  transform-origin: left;
  animation: titleRuleIn 0.86s 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.login-title-code,
.login-title-main {
  display: block;
}

.login-title-code {
  position: relative;
  width: fit-content;
  font-size: 66px;
  letter-spacing: 0;
  color: #f4c777;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.26));
}

.login-title-code::after {
  content: attr(data-title);
  position: absolute;
  inset: 0;
  color: transparent;
  background: linear-gradient(105deg, transparent 0%, transparent 38%, #fff0be 48%, #ffd589 54%, transparent 66%, transparent 100%);
  background-size: 260% 100%;
  background-position: 140% 50%;
  background-clip: text;
  -webkit-background-clip: text;
  opacity: 0;
  pointer-events: none;
  animation: titleGoldSweep 7.2s 1.2s ease-in-out infinite;
}

.login-title-main {
  color: #fff;
  line-height: 1.12;
}

.login-copy p {
  margin-bottom: 0;
  max-width: 720px;
  color: rgba(239, 247, 250, 0.88);
  font-size: 19px;
  line-height: 1.8;
  white-space: normal;
}

.login-copy .subtitle-line {
  display: block;
}

.login-copy .eyebrow {
  margin-bottom: 12px;
  color: #bfe9e2;
  font-size: 17px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.34);
}

.login-metrics {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 166px));
  gap: 12px;
  margin-top: 4px;
  transform: translateY(var(--login-left-offset));
}

.login-metrics span {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  animation: loginMetricIn 0.58s ease both;
}

.login-metrics span:nth-child(2) {
  animation-delay: 0.08s;
}

.login-metrics span:nth-child(3) {
  animation-delay: 0.16s;
}

.login-metrics strong {
  font-size: 19px;
  font-weight: 820;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.login-metrics small {
  color: rgba(239, 247, 250, 0.72);
  font-size: 12px;
  font-weight: 720;
}

.login-panel {
  --login-panel-button-y: -100px;
  position: relative;
  z-index: 3;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(34px, 5vw, 56px) 44px;
  overflow: hidden;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 251, 252, 0.94)),
    #fff;
  box-shadow: -28px 0 58px rgba(4, 18, 28, 0.34);
  animation: loginPanelIn 0.72s ease both;
}

.login-panel > * {
  position: relative;
  z-index: 2;
}

.login-panel-brand,
.login-panel-head,
.login-field,
.login-panel .btn,
.login-panel-status {
  transform: translateY(-100px);
}

.login-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: 4px;
  background: linear-gradient(90deg, #f0b866, var(--teal), var(--blue));
}

.login-panel-photo,
.login-panel-signage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-panel-photo {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.22) 48%, rgba(255, 255, 255, 0.62) 100%),
    url("brand/ruijin-8-dusk.jpg");
  background-position: 54% 100%;
  background-size: cover;
  opacity: 0.12;
  mask-image: linear-gradient(180deg, transparent 0%, transparent 28%, #000 52%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 28%, #000 52%, #000 100%);
}

.login-panel-signage {
  z-index: 1;
  background-image: url("brand/ruijin-signage2.png");
  background-position: right 30px bottom 18px;
  background-repeat: no-repeat;
  background-size: min(50%, 220px) auto;
  opacity: 0.5;
}

.login-panel-brand {
  display: block;
  margin-bottom: 14px;
  color: #17344a;
  font-size: 16px;
  font-weight: 820;
  letter-spacing: 0.04em;
}

.login-panel-head {
  margin-bottom: 6px;
}

.login-panel-head span {
  display: block;
  margin-bottom: 7px;
  color: #0a766c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.login-panel h2 {
  color: #14212b;
  font-size: 28px;
}

.login-panel-head p {
  margin: 8px 0 0;
  color: #5b6f7e;
  font-size: 13px;
  font-weight: 680;
}

.login-field {
  color: #263d4d;
}

.login-panel input {
  min-height: 50px;
  padding: 11px 13px;
  border-color: #c3d3dc;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 24px rgba(15, 35, 50, 0.06);
}

.login-panel input:focus {
  border-color: #0d6da9;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 111, 179, 0.16), 0 12px 28px rgba(15, 35, 50, 0.1);
}

.login-panel .btn {
  position: relative;
  min-height: 50px;
  margin-top: 4px;
  overflow: hidden;
  border-color: #0b5e94;
  background: linear-gradient(135deg, #0d6da9 0%, #0a8d80 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 14px 28px rgba(8, 93, 136, 0.27);
  transform: translateY(var(--login-panel-button-y));
}

.login-panel .btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 36%, rgba(255, 255, 255, 0.24) 50%, transparent 64%);
  transform: translateX(-120%);
  transition: transform 0.5s ease;
}

/* Login submit stays stationary; hover only changes color and sheen. */
.login-panel .btn:hover {
  background: linear-gradient(135deg, #0b5e94 0%, #087a71 100%);
  transform: translateY(var(--login-panel-button-y));
}

.login-panel .btn:active {
  transform: translateY(var(--login-panel-button-y));
}

.login-panel .btn:hover::after {
  transform: translateX(120%);
}

.login-panel-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2px;
  color: #5b6f7e;
  font-size: 12px;
  font-weight: 740;
}

.login-panel-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(17, 122, 95, 0.32);
  animation: loginStatusPulse 2.2s ease infinite;
}

/* Result and detail */

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.result-hero.has-allocation {
  grid-template-columns: minmax(0, 1fr) 200px;
  align-items: center;
}

.result-hero.compact {
  grid-template-columns: minmax(0, 1fr);
}

.result-hero p {
  margin-top: 8px;
  color: var(--muted);
}

.allocation-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 22px;
}

.allocation-card-compact {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  align-self: center;
  gap: 10px;
  width: 200px;
  min-height: 73px;
  padding: 0 12px;
}

.allocation-card.ip {
  border-color: rgba(11, 143, 130, 0.35);
  background: linear-gradient(180deg, #f2fbf9, #fff 70%);
}

.allocation-card.soc {
  border-color: rgba(183, 121, 31, 0.35);
  background: linear-gradient(180deg, #fdf7ec, #fff 70%);
}

.allocation-card span,
.allocation-card em {
  color: var(--muted);
  font-style: normal;
}

.allocation-card strong {
  font-size: 25px;
}

.allocation-card em {
  display: grid;
  place-items: center;
  min-width: 56px;
  width: fit-content;
  height: 56px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.allocation-card.ip em {
  background: linear-gradient(135deg, #0e9887, var(--teal-dark));
  box-shadow: 0 6px 16px rgba(8, 107, 96, 0.25);
}

.allocation-card.soc em {
  background: linear-gradient(135deg, #c8811a, var(--amber));
  box-shadow: 0 6px 16px rgba(183, 121, 31, 0.24);
}

.allocation-card-compact strong,
.allocation-card-compact em {
  white-space: nowrap;
}

.allocation-card-compact strong {
  font-size: 20px;
}

.allocation-card-compact em {
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 5px 11px;
  border-radius: 9px;
  font-size: 20px;
  line-height: 1.25;
}

.allocation-card-compact.ip em,
.allocation-card-compact.soc em {
  box-shadow: none;
}

.allocation-card-compact.ip em.arm-ip {
  border: 1px solid rgba(11, 143, 130, 0.28);
  color: #075f58;
  background: #ddf3ee;
}

.allocation-card-compact.soc em.arm-soc {
  border: 1px solid rgba(183, 121, 31, 0.3);
  color: #7a4f10;
  background: #fff1d8;
}

.randomize-panel {
  margin: 18px 0;
}

.patient-detail-actions {
  margin-top: 26px;
}

.patient-correction-notice {
  margin-top: 12px;
}

.detail-list {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px 18px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 720;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.filter-bar {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar label {
  min-width: 210px;
}

.filter-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  cursor: pointer;
}

.filter-check input {
  flex: 0 0 auto;
  margin: 0;
}

.detail-cell {
  max-width: 420px;
  overflow-wrap: anywhere;
}

.audit-ops-panel {
  margin-bottom: 18px;
}

.audit-ops-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.audit-reset-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.audit-action span {
  font-weight: 740;
}

.audit-target,
.audit-action {
  overflow-wrap: anywhere;
}

.audit-success .role-pill {
  min-width: 52px;
}

.audit-detail-row td {
  padding-top: 9px;
  padding-bottom: 12px;
  color: #30424f;
  background: #fbfdfe;
  white-space: normal;
}

.audit-detail-row span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.audit-detail-row p {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

@keyframes shellSidebarIn {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shellTopbarIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageBlockIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes surfaceRiseIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes detailFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tableRowIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progressBarGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes consoleGridDrift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 56px 0, 0 56px;
  }
}

@keyframes consoleTitleRule {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes systemPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(17, 122, 95, 0.3);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(17, 122, 95, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(17, 122, 95, 0);
  }
}

@keyframes consoleMetricIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes consoleCardSheen {
  0%,
  46% {
    transform: translateX(-90%) skewX(-18deg);
  }
  66%,
  100% {
    transform: translateX(360%) skewX(-18deg);
  }
}

@keyframes metricNumberPop {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes balanceSignal {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.28);
  }
}

@keyframes loginPhotoDrift {
  from {
    transform: scale(1.04) translate3d(-10px, 0, 0);
  }
  to {
    transform: scale(1.08) translate3d(12px, -8px, 0);
  }
}

@keyframes loginSheen {
  0%,
  42% {
    transform: translateX(-78%);
  }
  74%,
  100% {
    transform: translateX(78%);
  }
}

@keyframes loginReveal {
  from {
    opacity: 0;
    transform: translateY(calc(var(--login-left-offset, 0px) + 16px));
  }
  to {
    opacity: 1;
    transform: translateY(var(--login-left-offset, 0px));
  }
}

@keyframes titleGoldSweep {
  0%,
  56% {
    opacity: 0;
    background-position: 140% 50%;
  }
  62% {
    opacity: 0.78;
  }
  74% {
    opacity: 0.78;
    background-position: -40% 50%;
  }
  82%,
  100% {
    opacity: 0;
    background-position: -40% 50%;
  }
}

@keyframes titleRuleIn {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes loginPanelIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes loginMetricIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loginStatusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(17, 122, 95, 0.36);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(17, 122, 95, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(17, 122, 95, 0);
  }
}

/* Responsive */

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .form-workspace {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    gap: 0;
    padding: 10px 16px;
    overflow: visible;
  }

  .sidebar::after {
    display: none;
  }

  .sidebar-study,
  .sidebar-footer {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .mobile-logout {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 42px;
    padding: 0 12px;
    color: #dcebf4;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 760;
    white-space: nowrap;
  }

  .mobile-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 3px;
    max-height: calc(100vh - 64px);
    padding: 8px 12px 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, #0a2c44 0%, #0b3a44 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 34px rgba(4, 18, 28, 0.42);
  }

  .nav-toggle-cb:checked ~ .nav-links {
    display: flex;
  }

  .nav-links a {
    min-height: 48px;
    padding: 0 14px;
    font-size: 15px;
  }

  .nav-section {
    display: block;
    margin: 12px 14px 2px;
  }

  .topbar,
  .login-shell,
  .two-col,
  .center-admin-grid,
  .three-col,
  .result-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    display: none;
  }

  .workspace::before {
    inset: 0;
    background-position: center top;
  }

  .topbar-title {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-page .dashboard-side {
    display: contents;
  }

  .dashboard-side {
    grid-template-rows: auto;
    height: auto;
  }

  .dashboard-page .pending-panel {
    order: 1;
  }

  .dashboard-page .activity-panel {
    order: 2;
  }

  .dashboard-page .balance-panel {
    order: 3;
  }

  .balance-panel {
    height: auto;
    overflow-y: visible;
  }

  .activity-panel,
  .pending-panel {
    overflow: visible;
  }

  .activity-panel .record-list,
  .pending-panel .record-list {
    flex: none;
    overflow: visible;
  }

  .pending-panel .pending-record-list {
    max-height: 440px;
    overflow: auto;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-hero {
    min-height: 560px;
    padding: 34px 32px 42px;
  }

  .login-copy p {
    width: auto;
    max-width: 100%;
    white-space: normal;
  }

  .login-copy {
    padding-top: 42px;
  }

  .login-copy h1 {
    font-size: 48px;
  }

  .login-title-code {
    font-size: 56px;
  }

  .login-panel {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 -18px 44px rgba(4, 18, 28, 0.24);
  }

}

@media (max-width: 700px) {
  .desktop-label {
    display: none;
  }

  .mobile-label {
    display: inline;
  }

  .dashboard-page .balance-table {
    width: 100%;
    min-width: 0;
  }

  .dashboard-page .balance-col-arm,
  .dashboard-page .balance-col-diff,
  .dashboard-page .balance-cell-arm,
  .dashboard-page .balance-cell-diff {
    display: none;
  }

  .dashboard-page .balance-col-level {
    width: 58%;
  }

  .dashboard-page .balance-col-total {
    width: 16%;
  }

  .dashboard-page .balance-col-score {
    width: 26%;
  }

  .dashboard-page .balance-cell-total {
    padding-right: 4px;
    text-align: right;
  }

  .dashboard-page .balance-cell-score {
    padding-left: 4px;
    text-align: left;
  }

  .dashboard-page .balance-cell-score .balance-score {
    min-width: 0;
    justify-content: flex-start;
  }

  .page,
  .login-body .page {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .login-body .page {
    width: 100%;
    padding: 0;
    overflow: auto;
  }

  .login-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: 22px 18px 34px;
    overflow: hidden;
    color: #fff;
    background: #071625;
  }

  .login-shell::before,
  .login-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .login-shell::before {
    z-index: 0;
    background-image: url("brand/ruijin-campus-night.jpg");
    background-position: 58% 50%;
    background-size: cover;
    filter: saturate(0.98) contrast(1.08);
    transform: scale(1.04);
  }

  .login-shell::after {
    z-index: 0;
    background:
      linear-gradient(180deg, rgba(4, 17, 28, 0.58) 0%, rgba(4, 17, 28, 0.78) 42%, rgba(4, 17, 28, 0.9) 100%),
      linear-gradient(90deg, rgba(4, 17, 28, 0.9) 0%, rgba(5, 30, 49, 0.42) 100%);
  }

  .page-head,
  .locked-panel,
  .notice-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .registration-head {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    gap: 12px;
  }

  .registration-head > div {
    min-width: 0;
  }

  .registration-head .btn {
    flex: 0 0 auto;
    margin-top: 25px;
    min-height: 36px;
    padding: 0 12px;
  }

  .dashboard-head {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    gap: 12px;
  }

  .dashboard-head > div {
    min-width: 0;
  }

  .dashboard-head .status-chip {
    display: none;
  }

  .dashboard-head .page-note {
    display: none;
  }

  .dashboard-head .actions {
    flex: 0 0 auto;
    margin-top: 25px;
  }

  .dashboard-head .btn {
    min-height: 36px;
    padding: 0 12px;
  }

  .patients-head {
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    gap: 12px;
  }

  .patients-head > div {
    min-width: 0;
  }

  .patients-head .actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 25px;
  }

  .patients-head .btn {
    min-height: 34px;
    padding: 0 8px;
    font-size: 13px;
  }

  .patients-mobile-hidden {
    display: none;
  }

  .patients-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .patients-table th,
  .patients-table td {
    padding-right: 6px;
    padding-left: 6px;
  }

  .patients-table .patient-col-subject {
    width: 25%;
  }

  .patients-table .patient-col-name {
    width: 20%;
  }

  .patients-table .patient-col-status {
    width: 21%;
  }

  .patients-table .patient-col-arm {
    width: 20%;
  }

  .patients-table .patient-col-action {
    width: 14%;
    padding-right: 12px;
    text-align: right;
  }

  .patients-table-pending .patients-pending-mobile-hidden {
    display: none;
  }

  .patients-table-pending .patient-col-subject {
    width: 20%;
  }

  .patients-table-pending .patient-col-name {
    width: 13%;
  }

  .patients-table-pending .patient-col-center {
    width: 54%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .patients-table-pending .patient-col-action {
    width: 13%;
  }

  .dashboard-precheck {
    display: none;
  }

  .page-index .dashboard-page::after {
    display: none;
  }

  .confirm-head {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .confirm-head .btn {
    grid-column: auto;
    justify-self: end;
  }

  .registration-form-panel .section-head p,
  .registration-form-panel > .warning-strip {
    display: none;
  }

  .registration-section-head h2 {
    margin-top: 5px;
  }

  .form-grid,
  .check-panel,
  .center-admin-grid,
  .user-admin-grid,
  .side-stack {
    grid-template-columns: 1fr;
  }

  .center-ops-grid,
  .user-ops-grid {
    grid-template-columns: 1fr;
  }

  .center-ops-grid > a,
  .user-ops-grid > a {
    grid-column: auto;
  }

  .audit-ops-grid,
  .audit-reset-form {
    grid-template-columns: 1fr;
  }

  .filter-check {
    display: none;
  }

  .desktop-center-table,
  .desktop-user-table {
    display: none;
  }

  .mobile-center-list,
  .mobile-user-list {
    display: grid;
    gap: 10px;
  }

  .mobile-center-card,
  .mobile-user-card {
    display: grid;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .mobile-center-meta,
  .mobile-user-meta,
  .mobile-user-center {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .mobile-center-meta code,
  .mobile-user-center code {
    flex: 0 0 auto;
  }

  .mobile-center-pi,
  .mobile-user-center span {
    min-width: 0;
    color: #30424f;
    font-size: 13px;
    font-weight: 760;
    overflow-wrap: anywhere;
  }

  .mobile-center-name {
    min-width: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 720;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .mobile-user-meta strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .mobile-center-actions,
  .mobile-user-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
  }

  .mobile-center-actions form,
  .mobile-user-actions form {
    display: block;
    min-width: 0;
  }

  .mobile-center-actions .btn,
  .mobile-center-actions .role-pill,
  .mobile-user-actions .btn {
    width: 100%;
    min-height: 34px;
  }

  .table-wrap::-webkit-scrollbar {
    height: 8px;
  }

  .table-wrap::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #c6d4dd;
  }

  .table-wrap::-webkit-scrollbar-track {
    background: transparent;
  }

  .table-wrap th,
  .table-wrap td {
    white-space: nowrap;
  }

  .table-wrap td.detail-cell {
    max-width: 240px;
    white-space: normal;
  }

  .audit-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .audit-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
  }

  .audit-table colgroup {
    display: none;
  }

  .audit-table thead {
    display: none;
  }

  .audit-table tbody.audit-entry {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .audit-table tbody.audit-entry:last-of-type {
    margin-bottom: 0;
  }

  .audit-table .audit-row {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    padding: 10px 12px;
  }

  .audit-table .audit-row td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .audit-table .audit-row td::before {
    content: attr(data-label);
    display: inline;
    margin-right: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
  }

  .audit-table .audit-time {
    grid-column: 1 / -1;
  }

  .audit-table .audit-action span {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .audit-table .audit-detail-row {
    display: none !important;
    border-top: 1px solid #e7eef3;
  }

  .audit-table .audit-detail-row td {
    display: block;
    padding: 9px 12px 11px;
    border: 0;
    background: #fbfdfe;
    white-space: normal;
  }

  .audit-table .audit-detail-row span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 780;
  }

  .audit-table .audit-detail-row p {
    margin: 3px 0 0;
    color: #30424f;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .audit-table tbody tr:hover td,
  .audit-table .audit-row td:first-child {
    background: transparent;
  }

  .audit-table .audit-detail-row:hover td {
    background: #fbfdfe;
  }

  .table-wrap th:first-child,
  .table-wrap td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
  }

  .table-wrap td:first-child {
    background: #fff;
  }

  .table-wrap th:first-child {
    z-index: 2;
    background: #f6f9fb;
  }

  tbody tr:hover td:first-child {
    background: #f8fbfc;
  }

  .audit-table th:first-child,
  .audit-table td:first-child {
    position: static;
    left: auto;
    z-index: auto;
  }

  .audit-table .audit-row td:first-child,
  .audit-table tbody tr:hover td:first-child {
    background: transparent;
  }

  .audit-table .audit-detail-row td:first-child,
  .audit-table .audit-detail-row:hover td:first-child {
    background: #fbfdfe;
  }

  .panel,
  .metric,
  .login-panel,
  .login-hero {
    padding: 16px;
  }

  .login-hero {
    --login-left-offset: 0px;
    position: relative;
    z-index: 1;
    display: block;
    min-height: auto;
    padding: 0;
    overflow: visible;
  }

  .login-photo,
  .login-hero-shade,
  .login-hero::after,
  .login-panel::before,
  .login-panel-photo,
  .login-panel-signage,
  .login-panel-brand,
  .login-panel-head,
  .login-metrics,
  .login-panel-status {
    display: none;
  }

  .login-brand-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-lockup {
    width: min(330px, 100%);
  }

  .login-copy {
    padding-top: 34px;
    transform: none;
  }

  .login-copy .eyebrow {
    font-size: 13px;
  }

  .login-copy p {
    max-width: 100%;
    color: rgba(239, 247, 250, 0.86);
    font-size: 15px;
    line-height: 1.65;
  }

  .login-copy h1,
  h1 {
    font-size: 30px;
  }

  .login-title-code {
    font-size: 42px;
  }

  .login-panel {
    --login-panel-button-y: 0px;
    position: relative;
    z-index: 1;
    align-content: start;
    gap: 14px;
    padding: 22px 0 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
    animation: none;
  }

  .login-panel-brand,
  .login-panel-head,
  .login-field,
  .login-panel .btn,
  .login-panel-status {
    transform: none;
  }

  .login-field {
    color: rgba(239, 247, 250, 0.92);
    font-size: 15px;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
  }

  .login-panel input {
    min-height: 52px;
    border-color: rgba(202, 219, 229, 0.72);
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 14px 30px rgba(2, 16, 26, 0.22);
  }

  .login-panel .btn {
    min-height: 54px;
    margin-top: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 16px 32px rgba(2, 16, 26, 0.28);
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .patient-detail-grid .detail-list {
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    gap: 12px 14px;
  }

  .patient-detail-grid .detail-list dt {
    white-space: nowrap;
  }

  .patient-correction-notice {
    display: none;
  }

  .randomize-panel-note {
    display: none;
  }

  .system-dot {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .footer,
  .actions,
  .btn {
    display: none !important;
  }

  .app-shell,
  .workspace {
    display: block;
  }

  .workspace::before {
    display: none;
  }

  body,
  .page,
  .panel {
    background: #fff;
    box-shadow: none;
  }

  .page {
    width: 100%;
    padding: 0;
  }
}
