﻿:root {
  --paper: #F5FAFF;
  --paper-deep: #E1EEFA;
  --surface: #ffffff;
  --surface-soft: #E1EEFA;
  --primary: #297BBF;
  --large-blue: #2E7AB3;
  --primary-light: #E1EEFA;
  --success: #359966;
  --danger: #C73838;
  --title: #262626;
  --body-text: #4A4A4A;
  --assist: #757575;
  --border: #E0E7EF;
  --neutral: #808080;
  --primary-blue: #297BBF;
  --primary-blue-strong: #297BBF;
  --primary-blue-soft: #E1EEFA;
  --success-tone: #359966;
  --success-soft: #E1EEFA;
  --panel-blue: #E1EEFA;
  --primary-blue-solid: #297BBF;
  --danger-tone: #C73838;
  --blue: #297BBF;
  --blue-soft: #E1EEFA;
  --ink: #262626;
  --muted: #757575;
  --line: #E0E7EF;
  --line-strong: #E0E7EF;
  --white: #ffffff;
  --shadow: 0 22px 54px rgba(41, 123, 191, 0.12);
  --shadow-soft: 0 12px 30px rgba(41, 123, 191, 0.09);
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 15px;
}

/* 角色职责拆分：老人端少入口、家属端强管理、三端统一线性图标 */
.feature-icon { width: 30px; height: 30px; flex: 0 0 auto; }
.subnav button { display: flex; align-items: center; gap: 10px; }
.subnav .nav-icon { width: 21px; height: 21px; }
.action-tile { display: flex; align-items: center; gap: 16px; text-align: left; transition: transform .2s ease, box-shadow .2s ease; }
.action-tile:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(21, 78, 111, .12); }
.action-copy { display: grid; gap: 5px; }
.elder-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dashboard-hero { position: relative; overflow: hidden; }
.elder-hero { background: linear-gradient(135deg, #f8f1dc, #e8f5ef); }
.family-hero { background: linear-gradient(135deg, #e8f4ff, #eef8f3); }
body[data-mode="community"] .dashboard-hero { background: linear-gradient(135deg, #e8f5ed, #f4f8e8); }
.hero-ecg { position: absolute; inset: auto 4% 12px 42%; height: 70px; opacity: .18; pointer-events: none; }
.hero-ecg span { display: block; height: 100%; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 80'%3E%3Cpath d='M0 45h110l18-20 22 45 26-65 29 40h295' fill='none' stroke='%23104f5b' stroke-width='4'/%3E%3C/svg%3E"); }
.emergency-call { position: relative; width: 100%; margin: 18px 0; padding: 22px 28px; border: 0; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #b92d35, #df4a43); display: flex; align-items: center; justify-content: center; gap: 18px; text-align: left; cursor: pointer; box-shadow: 0 15px 30px rgba(185,45,53,.24); }
.emergency-call b { display: block; font-size: 1.4rem; }
.emergency-call small { display: block; margin-top: 3px; color: #fff; }
.emergency-icon { width: 40px; height: 40px; }
.emergency-pulse { position: absolute; inset: 6px; border: 2px solid rgba(255,255,255,.35); border-radius: 18px; animation: emergencyPulse 2s ease-out infinite; }
.readonly-note, .readonly-page { border-left: 4px solid #76a6a1; }
.confirmation-queue, .confirmation-history { margin: 0 0 22px; padding: 18px; border-radius: 18px; background: #f5faf8; border: 1px solid #d8e9e4; }
.management-form { margin-bottom: 22px; padding: 20px; border-radius: 18px; background: #f7fafc; }
.checkin-success .toast { background: #21845b; }
@keyframes emergencyPulse { 0% { transform: scale(.98); opacity: .7; } 70%,100% { transform: scale(1.02); opacity: 0; } }
@media (max-width: 1180px) { .elder-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .elder-actions { grid-template-columns: 1fr; } .emergency-call { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { .emergency-pulse { animation: none; } .action-tile { transition: none; } }

/* 家属端保持 09 方案前的标准字号；仅老人端使用适老化放大字号。 */
body[data-mode="family"] { font-size: 18px; }
body[data-mode="family"] h2 { font-size: 31px; }
body[data-mode="family"] h3 { font-size: 22px; }
body[data-mode="family"] p,
body[data-mode="family"] .list li p,
body[data-mode="family"] .readable-lead,
body[data-mode="family"] .readable-list li,
body[data-mode="family"] .readable-paragraphs p { font-size: 18px; }
body[data-mode="family"] .small,
body[data-mode="family"] .session span { font-size: 15px; }
body[data-mode="family"] button,
body[data-mode="family"] input,
body[data-mode="family"] select,
body[data-mode="family"] textarea { font-size: 18px; }
body[data-mode="family"] .readable-title { font-size: 20px; }
@media (max-width: 560px) { body[data-mode="family"] { font-size: 17px; } }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 8%, rgba(41, 123, 191, 0.28), transparent 32%),
    radial-gradient(circle at 92% 12%, rgba(41, 123, 191, 0.2), transparent 30%),
    linear-gradient(145deg, #F5FAFF 0%, #E1EEFA 52%, #F5FAFF 100%);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 18px;
  letter-spacing: 0;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(41, 123, 191, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 123, 191, 0.05) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 88%);
}

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

button {
  min-height: 48px;
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 4px solid rgba(41, 123, 191, 0.26);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 38px);
  background: rgba(245, 250, 255, 0.86);
  border-bottom: 1px solid rgba(41, 123, 191, 0.12);
  box-shadow: 0 10px 32px rgba(41, 123, 191, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: var(--white);
  background:
    linear-gradient(145deg, var(--primary-blue-strong), var(--primary-blue)),
    var(--primary-blue);
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.12), 0 12px 24px rgba(41, 123, 191, 0.22);
  font-size: 26px;
  font-weight: 900;
}

.brand strong,
.session b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.brand small,
.session span,
.small {
  color: var(--muted);
  font-size: 15px;
}

.session {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.auth-actions .primary,
.auth-actions .plain {
  width: auto;
  min-width: 96px;
  min-height: 44px;
  padding: 9px 16px;
}

.icon-btn {
  min-width: 86px;
}

.app-shell {
  width: min(1760px, calc(100% - 32px));
  margin: 22px auto 34px;
}

body[data-mode="landing"],
body[data-mode="login"] {
  background:
    radial-gradient(circle at 12% 14%, rgba(41, 123, 191, 0.34), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(41, 123, 191, 0.18), transparent 31%),
    linear-gradient(140deg, #F5FAFF 0%, #E1EEFA 50%, #F5FAFF 100%);
}

body[data-mode="landing"] .app-shell,
body[data-mode="login"] .app-shell {
  display: grid;
  min-height: calc(100vh - 112px);
}

.landing-page {
  display: grid;
  gap: 22px;
  min-height: calc(100vh - 136px);
}

.landing-hero,
.landing-section {
  border: 1px solid rgba(41, 123, 191, 0.13);
  border-radius: var(--radius-lg);
  background: rgba(245, 250, 255, 0.86);
  box-shadow: var(--shadow);
}

.landing-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  overflow: hidden;
  min-height: 430px;
  padding: clamp(30px, 6vw, 76px);
  background:
    linear-gradient(115deg, rgba(245, 250, 255, 0.96) 0%, rgba(225, 238, 250, 0.92) 42%, rgba(225, 238, 250, 0.88) 100%);
}

.landing-hero::before,
.landing-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.landing-hero::before {
  right: clamp(26px, 5vw, 80px);
  bottom: -80px;
  width: clamp(240px, 32vw, 460px);
  height: clamp(240px, 32vw, 460px);
  background:
    radial-gradient(circle, rgba(41, 123, 191, 0.24), rgba(41, 123, 191, 0.08) 56%, transparent 58%),
    radial-gradient(circle at 36% 38%, rgba(41, 123, 191, 0.42), transparent 35%);
}

.landing-hero::after {
  right: clamp(54px, 9vw, 150px);
  top: clamp(36px, 8vw, 96px);
  width: clamp(120px, 14vw, 190px);
  height: clamp(120px, 14vw, 190px);
  border: 1px solid rgba(41, 123, 191, 0.2);
  background: rgba(245, 250, 255, 0.58);
  box-shadow: inset 0 0 0 18px rgba(225, 238, 250, 0.62);
}

.landing-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 12px;
  max-width: 940px;
}

.landing-copy h1 {
  margin-bottom: 8px;
  color: var(--primary-blue-strong);
  font-size: clamp(58px, 7vw, 104px);
  letter-spacing: -0.04em;
}

.landing-copy .lead {
  max-width: 900px;
  color: #4A4A4A;
  font-size: 24px;
}

.landing-actions {
  margin-top: 16px;
}

.landing-summary {
  display: grid;
  gap: 12px;
  align-content: center;
}

.landing-stat {
  display: grid;
  gap: 5px;
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(41, 123, 191, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.landing-stat span,
.landing-stat small {
  color: var(--muted);
}

.landing-stat b {
  color: var(--primary-blue-strong);
  font-size: 40px;
  line-height: 1;
}

.landing-section {
  padding: clamp(24px, 4vw, 42px);
}

.landing-section h2 {
  max-width: 880px;
  color: var(--ink);
  font-size: 36px;
}

.landing-feature-grid,
.landing-roles {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-feature,
.role-card {
  min-height: 166px;
  padding: 22px;
  border: 1px solid rgba(41, 123, 191, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
}

.landing-feature b,
.role-card b {
  display: block;
  margin-bottom: 9px;
  color: var(--primary-blue-strong);
  font-size: 24px;
}

.landing-feature p,
.role-card p {
  margin-bottom: 0;
  color: #4A4A4A;
  line-height: 1.62;
}

.role-card span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 12px;
  border: 1px solid rgba(41, 123, 191, 0.25);
  border-radius: 999px;
  color: var(--primary-blue-solid);
  background: rgba(41, 123, 191, 0.18);
  font-size: 15px;
  font-weight: 900;
}

.elder-role {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(41, 123, 191, 0.18));
}

.family-role {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(53, 153, 102, 0.15));
}

.community-role {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(41, 123, 191, 0.14));
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(390px, 0.75fr);
  gap: 22px;
  align-items: stretch;
  min-height: calc(100vh - 136px);
}

.login-copy,
.login-card,
.panel,
.card,
.result-box,
.side {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(245, 250, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.login-copy,
.login-card,
.panel,
.card,
.result-box {
  padding: 24px;
}

.login-copy {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: space-between;
  gap: 22px;
  overflow: hidden;
  min-height: 100%;
  padding: clamp(28px, 4vw, 48px);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 85% 16%, rgba(41, 123, 191, 0.34), transparent 24%),
    linear-gradient(140deg, var(--large-blue) 0%, var(--large-blue) 52%, var(--large-blue) 100%);
  box-shadow: 0 28px 70px rgba(41, 123, 191, 0.22);
}

.login-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.13), transparent 36%),
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.18) 100%);
  pointer-events: none;
}

.login-copy > * {
  position: relative;
}

.login-hero-copy {
  max-width: 940px;
}

.login-copy .eyebrow {
  color: rgba(255, 255, 255, 0.96);
}

.login-copy h1 {
  margin-bottom: 14px;
  color: var(--white);
  font-size: clamp(58px, 6vw, 82px);
  letter-spacing: -0.04em;
}

.login-copy .lead {
  max-width: 900px;
  color: rgba(255, 255, 255, 0.86);
}

.login-signal-grid,
.login-feature-strip {
  display: grid;
  gap: 13px;
}

.login-signal-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.login-signal,
.login-feature,
.login-account-panel {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.13);
}

.login-signal {
  display: grid;
  gap: 5px;
  min-height: 120px;
  padding: 17px;
}

.login-signal span,
.login-signal small,
.login-feature span {
  color: rgba(255, 255, 255, 0.76);
}

.login-signal b {
  color: var(--white);
  font-size: 36px;
  line-height: 1;
}

.login-signal.gold {
  background: rgba(41, 123, 191, 0.2);
}

.login-signal.sage {
  background: rgba(53, 153, 102, 0.24);
}

.login-signal.blue {
  background: rgba(41, 123, 191, 0.24);
}

.login-signal.rose {
  background: rgba(199, 56, 56, 0.24);
}

.login-feature-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.login-feature {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 120px;
  padding: 17px;
}

.login-feature b {
  color: var(--white);
  font-size: 22px;
}

.login-feature span {
  line-height: 1.5;
}

.login-account-panel {
  padding: 18px;
  background: rgba(255, 255, 255, 0.1);
}

.login-account-panel h3 {
  margin-bottom: 0;
  color: var(--white);
}

.login-side-stack {
  display: grid;
  grid-template-rows: auto;
  gap: 18px;
  min-height: 0;
}

.login-card {
  align-self: start;
  background: rgba(245, 250, 255, 0.96);
}

.login-card .primary {
  width: 100%;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px;
  border: 1px solid rgba(41, 123, 191, 0.12);
  border-radius: 999px;
  background: rgba(225, 238, 250, 0.72);
}

.auth-tabs button {
  min-width: 0;
  border-radius: 999px;
  color: var(--primary-blue-strong);
  background: transparent;
  font-weight: 900;
}

.auth-tabs button.active {
  color: var(--white);
  background: var(--primary-blue-strong);
  box-shadow: 0 10px 18px rgba(41, 123, 191, 0.18);
}

.register-note {
  margin-top: 18px;
  padding: 16px 0 0 18px;
  border-left: 6px solid var(--success-tone);
}

.register-note p {
  margin-bottom: 0;
  color: #4A4A4A;
  font-size: 20px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-blue-strong);
  font-weight: 900;
  letter-spacing: 0.04em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: 64px;
  line-height: 1.04;
}

h2 {
  margin-bottom: 14px;
  font-size: 31px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.22;
}

.lead {
  max-width: 820px;
  color: #4A4A4A;
  font-size: 22px;
  line-height: 1.65;
}

.dashboard {
  display: grid;
  gap: 18px;
  align-content: start;
  min-height: 100%;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.7fr);
  gap: 18px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid rgba(41, 123, 191, 0.14);
  border-radius: var(--radius-lg);
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 16%, rgba(41, 123, 191, 0.32), transparent 24%),
    linear-gradient(135deg, rgba(245, 250, 255, 0.96), rgba(225, 238, 250, 0.88));
  box-shadow: var(--shadow);
}

.dashboard-hero,
.panel,
.card,
.action-tile,
.alert-banner {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.action-tile:hover,
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(41, 123, 191, 0.32);
  box-shadow: var(--shadow);
}

.dashboard-hero h2 {
  margin-bottom: 10px;
  color: var(--primary-blue-strong);
  font-size: 37px;
}

.dashboard-hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: #4A4A4A;
  line-height: 1.65;
}

.dashboard-hero .eyebrow {
  color: var(--primary-blue-solid);
}

.family-hero {
  background:
    radial-gradient(circle at 90% 18%, rgba(53, 153, 102, 0.28), transparent 24%),
    linear-gradient(135deg, rgba(245, 250, 255, 0.96), rgba(225, 238, 250, 0.9));
}

.community-hero {
  background:
    radial-gradient(circle at 88% 12%, rgba(41, 123, 191, 0.24), transparent 24%),
    linear-gradient(135deg, rgba(245, 250, 255, 0.96), rgba(225, 238, 250, 0.92));
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-hero .metric {
  border-color: rgba(41, 123, 191, 0.14);
  background: rgba(255, 255, 255, 0.68);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.elder-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.action-tile {
  position: relative;
  display: grid;
  align-content: center;
  gap: 9px;
  overflow: hidden;
  min-height: 138px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-align: left;
  background: rgba(245, 250, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.action-tile::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(41, 123, 191, 0.08);
}

.action-tile b,
.action-tile span {
  position: relative;
  z-index: 1;
}

.action-tile b {
  font-size: 26px;
  line-height: 1.18;
}

.action-tile span {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.action-tile.gold {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(41, 123, 191, 0.22));
}

.action-tile.sage {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(53, 153, 102, 0.18));
}

.action-tile.blue {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(41, 123, 191, 0.16));
}

.action-tile.soft {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(225, 238, 250, 0.42));
}

.action-tile.rose,
.danger-tile {
  background: linear-gradient(145deg, rgba(245, 250, 255, 0.96), rgba(199, 56, 56, 0.14));
}

.danger-tile b,
.danger-tile span {
  color: #C73838;
}

.panel.inset {
  padding: 20px;
  box-shadow: none;
}

.alert-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(245, 250, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.alert-banner.alert-danger {
  border-color: rgba(199, 56, 56, 0.32);
  background: rgba(199, 56, 56, 0.12);
}

.alert-banner.alert-danger b {
  color: #C73838;
}

.account-grid,
.grid,
.two-col,
.three-col,
.compact-grid {
  display: grid;
  gap: 14px;
}

.account-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-card,
.metric {
  padding: 16px;
  text-align: left;
  border: 1px solid rgba(41, 123, 191, 0.15);
  border-radius: 20px;
  background: rgba(225, 238, 250, 0.52);
}

.account-card span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 15px;
}

.account-card b,
.metric b,
.binding-code {
  display: block;
  color: var(--primary-blue-strong);
  font-size: 26px;
  font-weight: 900;
}

.binding-code {
  margin: 8px 0 16px;
  color: var(--primary-blue-strong);
  font-size: 42px;
}

.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 136px);
}

.side {
  align-self: start;
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 20px;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 20% 6%, rgba(41, 123, 191, 0.24), transparent 30%),
    linear-gradient(180deg, var(--large-blue), var(--large-blue) 58%, var(--large-blue));
  box-shadow: 0 22px 48px rgba(41, 123, 191, 0.19);
}

.side h2 {
  color: var(--white);
}

.side .small {
  color: rgba(255, 255, 255, 0.76);
}

.subnav {
  display: grid;
  gap: 9px;
}

.subnav button {
  justify-content: flex-start;
  width: 100%;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.1);
  text-align: left;
}

.subnav button.active {
  color: var(--primary-blue-strong);
  border-color: rgba(255, 255, 255, 0.62);
  background: #F5FAFF;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.14);
}

.content {
  display: grid;
  gap: 15px;
  min-width: 0;
  min-height: 0;
}

.project-footer {
  display: grid;
  gap: 4px;
  justify-items: center;
  margin: 0 auto;
  padding: 14px 10px 4px;
  color: var(--muted);
  text-align: center;
}

.project-footer b {
  color: var(--primary-blue-strong);
  font-size: 18px;
}

.project-footer span {
  font-size: 15px;
}

.section-head {
  display: flex;
  gap: 14px;
  align-items: start;
  justify-content: space-between;
}

.form-grid {
  display: grid;
  gap: 13px;
}

.full-panel {
  min-height: 100%;
}

.empty-state {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  min-height: 360px;
  background:
    radial-gradient(circle at 92% 12%, rgba(41, 123, 191, 0.24), transparent 24%),
    linear-gradient(135deg, rgba(245, 250, 255, 0.96), rgba(225, 238, 250, 0.82));
}

.empty-state p {
  max-width: 720px;
  color: #4A4A4A;
  line-height: 1.65;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.check-title,
.check-label {
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface);
}

input,
select {
  min-height: 52px;
  padding: 11px 13px;
}

input[type="file"] {
  padding: 10px;
}

textarea {
  min-height: 150px;
  padding: 13px;
  line-height: 1.58;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.button-row.tight {
  margin-top: 8px;
}

.voice-btn {
  min-width: 190px;
}

.voice-status {
  margin: 2px 0 0;
  padding: 13px 15px;
  color: var(--primary-blue-strong);
  background: rgba(225, 238, 250, 0.72);
  border: 1px solid rgba(41, 123, 191, 0.18);
  border-radius: 16px;
  font-weight: 800;
}

.primary,
.secondary,
.danger,
.plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 900;
}

.primary {
  color: var(--white);
  background: linear-gradient(135deg, var(--primary-blue-strong), var(--primary-blue));
  box-shadow: 0 12px 22px rgba(41, 123, 191, 0.18);
}

.secondary {
  color: #4A4A4A;
  background: linear-gradient(135deg, #E1EEFA, var(--panel-blue));
}

.danger {
  color: var(--white);
  background: linear-gradient(135deg, #C73838, var(--danger-tone));
}

.plain {
  color: var(--primary-blue-strong);
  background: rgba(245, 250, 255, 0.78);
  border: 1px solid var(--line);
}

.danger-text {
  color: #C73838;
}

.span-2 {
  grid-column: 1 / -1;
}

.checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.check-label input {
  width: 22px;
  min-height: 22px;
}

.list {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.list.dense {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.list li {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(245, 250, 255, 0.92);
}

.list li p {
  color: #4A4A4A;
  line-height: 1.55;
}

.alert-item .button-row {
  margin-top: 12px;
}

.records-head {
  margin-top: 18px;
}

.stat-strip {
  margin-bottom: 18px;
}

.detail-grid,
.family-detail-grid,
.stats-dashboard {
  display: grid;
  gap: 15px;
}

.detail-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  margin-top: 14px;
}

.family-detail-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.55fr);
  margin-bottom: 14px;
}

.profile-card,
.risk-card,
.adherence-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(245, 250, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.profile-card {
  padding: 24px;
}

.profile-card h3 {
  margin-bottom: 8px;
  color: var(--primary-blue-strong);
  font-size: 34px;
}

.profile-lines {
  display: grid;
  gap: 7px;
  color: #4A4A4A;
}

.risk-card {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
}

.risk-card span,
.adherence-card span {
  color: var(--muted);
  font-size: 15px;
}

.risk-card b,
.adherence-card b {
  display: block;
  color: var(--primary-blue-strong);
  font-size: 42px;
  line-height: 1.05;
}

.risk-card p {
  margin-bottom: 0;
  color: #4A4A4A;
}

.stats-dashboard {
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.55fr) minmax(220px, 0.55fr);
  margin-bottom: 14px;
}

.adherence-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  background: rgba(41, 123, 191, 0.16);
}

.progress-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(41, 123, 191, 0.14);
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success-tone), var(--primary-blue));
}

.medicine-stats-list li {
  display: grid;
  gap: 10px;
}

.checkin-list li,
.medicine-plan-list li {
  min-height: 118px;
}

.archive-summary {
  align-content: start;
}

.tags,
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(41, 123, 191, 0.28);
  border: 1px solid rgba(41, 123, 191, 0.24);
  color: #4A4A4A;
  font-size: 15px;
  font-weight: 900;
}

.pill {
  color: var(--primary-blue-strong);
  background: rgba(225, 238, 250, 0.74);
  border-color: rgba(41, 123, 191, 0.18);
}

.warning {
  border-left: 7px solid var(--danger-tone) !important;
}

.ok {
  border-left: 7px solid var(--success-tone) !important;
}

.report-status {
  border-left: 7px solid var(--primary-blue) !important;
  background: linear-gradient(135deg, #E1EEFA, #F5FAFF);
}

.report-status h3 {
  color: var(--primary-blue-strong);
}

.report-status p {
  margin-bottom: 0;
  color: var(--text-main);
}

.source-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.table th,
.table td {
  padding: 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table th {
  color: var(--primary-blue-strong);
  background: rgba(225, 238, 250, 0.72);
}

.community-broadcast {
  display: grid;
  gap: 16px;
}

.broadcast-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.broadcast-item {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 230px;
  background:
    radial-gradient(circle at 94% 12%, rgba(41, 123, 191, 0.24), transparent 26%),
    rgba(245, 250, 255, 0.94) !important;
}

.broadcast-item > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.broadcast-item b {
  color: var(--primary-blue-strong);
  font-size: 23px;
  line-height: 1.25;
}

.broadcast-item p {
  margin-bottom: 0;
}

.broadcast-item small {
  color: var(--muted);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: 420px;
  padding: 15px 19px;
  border-radius: 18px;
  color: var(--white);
  background: var(--primary-blue-strong);
  box-shadow: var(--shadow);
  transform: translateY(140%);
  transition: transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
}

body[data-mode="elder"] {
  font-size: 24px;
}

body[data-mode="elder"],
body[data-mode="family"],
body[data-mode="community"] {
  background:
    radial-gradient(circle at 7% 12%, rgba(41, 123, 191, 0.25), transparent 32%),
    radial-gradient(circle at 92% 12%, rgba(41, 123, 191, 0.18), transparent 30%),
    linear-gradient(145deg, #F5FAFF 0%, #E1EEFA 52%, #F5FAFF 100%);
}

body[data-mode="elder"] .app-shell,
body[data-mode="family"] .app-shell,
body[data-mode="community"] .app-shell {
  display: grid;
  width: 100%;
  min-height: calc(100vh - 112px);
  margin: 0;
  padding: 18px clamp(12px, 2vw, 30px) 30px;
}

body[data-mode="elder"] .app-shell {
  padding: 14px clamp(8px, 1.5vw, 26px) 28px;
}

body[data-mode="elder"] .layout,
body[data-mode="family"] .layout,
body[data-mode="community"] .layout {
  width: 100%;
  min-height: calc(100vh - 124px);
}

body[data-mode="elder"] .layout {
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 16px;
}

body[data-mode="elder"] .side,
body[data-mode="family"] .side,
body[data-mode="community"] .side {
  max-height: none;
}

body[data-mode="elder"] .panel,
body[data-mode="elder"] .card,
body[data-mode="elder"] .result-box {
  padding: 30px;
}

body[data-mode="elder"] {
  font-size: 24px;
}

body[data-mode="elder"] h2 {
  font-size: 48px;
}

body[data-mode="elder"] h3 {
  font-size: 34px;
}

body[data-mode="elder"] p,
body[data-mode="elder"] .list li p,
body[data-mode="elder"] .profile-lines,
body[data-mode="elder"] .risk-card p,
body[data-mode="elder"] .source-list {
  font-size: 25px;
  line-height: 1.75;
}

body[data-mode="elder"] .small,
body[data-mode="elder"] .brand small,
body[data-mode="elder"] .session span {
  font-size: 22px;
}

body[data-mode="elder"] button {
  min-height: 80px;
  font-size: 28px;
}

body[data-mode="elder"] input,
body[data-mode="elder"] select {
  min-height: 78px;
  font-size: 28px;
}

body[data-mode="elder"] textarea {
  min-height: 240px;
  font-size: 28px;
}

body[data-mode="elder"] .list li {
  padding: 20px;
}

body[data-mode="elder"] .dashboard-hero h2 {
  font-size: 54px;
}

body[data-mode="elder"] .dashboard-hero p,
body[data-mode="elder"] .action-tile span {
  font-size: 26px;
}

body[data-mode="elder"] .action-tile {
  min-height: 190px;
}

body[data-mode="elder"] .action-tile b {
  font-size: 40px;
}

@media (max-width: 960px) {
  .topbar,
  .landing-hero,
  .landing-feature-grid,
  .landing-roles,
  .login-layout,
  .login-signal-grid,
  .login-feature-strip,
  .layout,
  .dashboard-hero,
  .detail-grid,
  .family-detail-grid,
  .stats-dashboard,
  .two-col,
  .three-col,
  .account-grid,
  .action-grid,
  .elder-actions,
  .list.dense,
  .broadcast-list {
    grid-template-columns: 1fr;
  }

  body[data-mode="elder"] .layout,
  body[data-mode="family"] .layout,
  body[data-mode="community"] .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-actions {
    width: 100%;
  }

  .auth-actions .primary,
  .auth-actions .plain {
    flex: 1;
  }

  .landing-hero,
  .login-layout {
    min-height: auto;
  }

  .landing-hero::before,
  .landing-hero::after {
    opacity: 0.34;
  }

  .layout {
    min-height: auto;
  }

  .side {
    position: static;
    max-height: none;
  }

  .section-head {
    flex-direction: column;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .checks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .app-shell {
    width: min(100% - 16px, 1320px);
    margin-top: 12px;
  }

  h1 {
    font-size: 48px;
  }

  .landing-page {
    gap: 12px;
    min-height: auto;
  }

  .landing-hero,
  .landing-section,
  .login-copy,
  .login-card,
  .panel,
  .card,
  .result-box {
    padding: 18px;
  }

  .landing-copy h1,
  .login-copy h1 {
    font-size: 48px;
  }

  .landing-copy .lead,
  .login-copy .lead {
    font-size: 19px;
    line-height: 1.55;
  }

  .dashboard-hero {
    padding: 20px;
  }

  .checks {
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary,
  .danger,
  .plain {
    width: 100%;
  }

  .auth-actions .primary,
  .auth-actions .plain {
    width: auto;
  }
}

/* Final sky-blue theme override: matches the requested palette while preserving layout. */
body,
body[data-mode="landing"],
body[data-mode="login"],
body[data-mode="elder"],
body[data-mode="family"],
body[data-mode="community"] {
  color: #262626;
  background:
    radial-gradient(circle at 9% 9%, rgba(41, 123, 191, 0.14), transparent 32%),
    radial-gradient(circle at 90% 12%, rgba(225, 238, 250, 0.95), transparent 34%),
    linear-gradient(145deg, #F5FAFF 0%, #E1EEFA 56%, #F5FAFF 100%);
}

body::before {
  background-image:
    linear-gradient(rgba(41, 123, 191, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 123, 191, 0.05) 1px, transparent 1px);
}

.topbar {
  background: rgba(245, 250, 255, 0.92);
  border-bottom-color: #E0E7EF;
  box-shadow: 0 10px 30px rgba(41, 123, 191, 0.08);
}

.brand-mark,
.primary,
.toast {
  color: #ffffff;
  background: linear-gradient(135deg, #297BBF, #297BBF);
}

.brand-mark,
.primary {
  box-shadow: 0 12px 24px rgba(41, 123, 191, 0.2);
}

.brand strong,
.session b,
h1,
h2,
h3,
.landing-section h2,
.landing-copy h1,
.dashboard-hero h2,
.profile-card h3,
.metric b,
.account-card b,
.binding-code,
.landing-feature b,
.role-card b,
.broadcast-item b,
.project-footer b,
.readable-title {
  color: #262626;
}

p,
.lead,
.landing-copy .lead,
.landing-feature p,
.role-card p,
.dashboard-hero p,
.empty-state p,
.list li p,
.profile-lines,
.risk-card p,
.readable-lead,
.readable-list li {
  color: #4A4A4A;
}

.brand small,
.session span,
.small,
.metric span,
.metric small,
.account-card span,
.landing-stat span,
.landing-stat small,
.risk-card span,
.adherence-card span,
.source-list,
.broadcast-item small,
.project-footer,
.project-footer span {
  color: #757575;
}

.landing-hero,
.landing-section,
.login-card,
.panel,
.card,
.result-box,
.alert-banner,
.profile-card,
.risk-card,
.adherence-card,
.table,
.list li {
  border-color: #E0E7EF;
  background: rgba(255, 255, 255, 0.94);
}

.landing-hero,
.dashboard-hero,
.empty-state {
  background:
    radial-gradient(circle at 92% 14%, rgba(41, 123, 191, 0.14), transparent 27%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(225, 238, 250, 0.92));
}

.login-copy,
.side {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 84% 12%, rgba(225, 238, 250, 0.24), transparent 28%),
    linear-gradient(145deg, var(--large-blue) 0%, var(--large-blue) 58%, var(--large-blue) 100%);
}

.login-copy .eyebrow,
.dashboard-hero .eyebrow,
.eyebrow {
  color: #297BBF;
}

.login-copy h1,
.login-copy .lead,
.login-copy .eyebrow,
.login-copy .login-feature b,
.login-copy .login-account-panel h3,
.side h2 {
  color: #ffffff;
}

.side .small,
.login-copy .lead,
.login-signal span,
.login-signal small,
.login-feature span {
  color: rgba(255, 255, 255, 0.82);
}

.login-signal,
.login-feature,
.login-account-panel,
.subnav button {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.13);
}

.auth-tabs,
.voice-status,
.metric,
.account-card,
.landing-stat,
.adherence-card,
.table th,
.pill {
  border-color: #E0E7EF;
  background: #E1EEFA;
}

.auth-tabs button,
.plain,
.subnav button.active,
.voice-status,
.pill {
  color: #297BBF;
}

.auth-tabs button.active,
.subnav button.active {
  color: #ffffff;
  background: #297BBF;
}

.subnav button {
  color: rgba(255, 255, 255, 0.9);
}

.action-tile,
.action-tile.gold,
.action-tile.sage,
.action-tile.blue,
.action-tile.soft,
.role-card,
.elder-role,
.family-role,
.community-role,
.broadcast-item {
  border-color: #E0E7EF;
  background:
    radial-gradient(circle at 92% 14%, rgba(41, 123, 191, 0.12), transparent 28%),
    linear-gradient(145deg, #ffffff, #E1EEFA);
}

.action-tile::after {
  background: rgba(41, 123, 191, 0.1);
}

.action-tile span {
  color: #757575;
}

.secondary {
  color: #ffffff;
  background: #297BBF;
}

.plain {
  background: #ffffff;
  border-color: #E0E7EF;
}

.danger,
.danger-tile,
.action-tile.rose,
.alert-banner.alert-danger {
  background: rgba(199, 56, 56, 0.09);
}

.danger {
  color: #ffffff;
  background: #C73838;
}

.danger-text,
.danger-tile b,
.danger-tile span,
.alert-banner.alert-danger b {
  color: #C73838;
}

.warning {
  border-left-color: #C73838 !important;
}

.ok {
  border-left-color: #359966 !important;
}

.tag {
  color: #297BBF;
  border-color: #E0E7EF;
  background: #E1EEFA;
}

.progress-track {
  background: #E1EEFA;
}

.progress-track i {
  background: linear-gradient(90deg, #359966, #297BBF);
}

input,
select,
textarea,
.check-label {
  color: #262626;
  border-color: #E0E7EF;
  background: #ffffff;
}

.readable-text {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #E0E7EF;
  border-radius: 18px;
  background: #F5FAFF;
}

.readable-title {
  display: block;
  font-size: 20px;
  font-weight: 900;
}

.readable-lead {
  margin: 0;
  line-height: 1.75;
}

.readable-paragraphs {
  display: grid;
  gap: 10px;
}

.readable-paragraphs p {
  margin: 0;
  line-height: 1.75;
}

.readable-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.readable-list li {
  position: relative;
  padding: 12px 14px 12px 38px;
  border: 1px solid #E0E7EF;
  border-radius: 16px;
  background: #ffffff;
  line-height: 1.68;
}

.readable-list li::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 1.15em;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #297BBF;
}

body[data-mode="elder"] .readable-title {
  font-size: 31px;
}

body[data-mode="elder"] .readable-list li,
body[data-mode="elder"] .readable-lead,
body[data-mode="elder"] .readable-paragraphs p {
  font-size: 29px;
}

.plain {
  color: #808080;
  background: #ffffff;
  border-color: #E0E7EF;
}

/* 最终角色主题覆盖层 */
.feature-icon { width: 30px; height: 30px; flex: 0 0 auto; }
.subnav button { display: flex; align-items: center; gap: 10px; }
.subnav .nav-icon { width: 21px; height: 21px; }
.action-tile { display: flex; align-items: center; gap: 16px; text-align: left; transition: transform .2s ease, box-shadow .2s ease; }
.action-tile:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(21,78,111,.12); }
.action-copy { display: grid; gap: 5px; }
.elder-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dashboard-hero { position: relative; overflow: hidden; }
.elder-hero { background: linear-gradient(135deg, #f8f1dc, #e8f5ef); }
.family-hero { background: linear-gradient(135deg, #e8f4ff, #eef8f3); }
body[data-mode="community"] .dashboard-hero { background: linear-gradient(135deg, #e8f5ed, #f4f8e8); }
.emergency-call { position: relative; width: 100%; margin: 18px 0; padding: 22px 28px; border: 0; border-radius: 22px; color: #fff; background: linear-gradient(135deg, #b92d35, #df4a43); display: flex; align-items: center; justify-content: center; gap: 18px; text-align: left; cursor: pointer; box-shadow: 0 15px 30px rgba(185,45,53,.24); }
.emergency-call b { display: block; font-size: 1.4rem; }.emergency-call small { display: block; margin-top: 3px; color: #fff; }.emergency-icon { width: 40px; height: 40px; }
.emergency-pulse { position: absolute; inset: 6px; border: 2px solid rgba(255,255,255,.35); border-radius: 18px; animation: emergencyPulse 2s ease-out infinite; pointer-events: none; }
.readonly-note, .readonly-page { border-left: 4px solid #76a6a1; }.confirmation-queue, .confirmation-history { margin: 0 0 22px; padding: 18px; border-radius: 18px; background: #f5faf8; border: 1px solid #d8e9e4; }.management-form { margin-bottom: 22px; padding: 20px; border-radius: 18px; background: #f7fafc; }
@keyframes emergencyPulse { 0% { transform: scale(.98); opacity: .7; } 70%,100% { transform: scale(1.02); opacity: 0; } }
@media (max-width: 1180px) { .elder-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .elder-actions { grid-template-columns: 1fr; } .emergency-call { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { .emergency-pulse { animation: none; } .action-tile { transition: none; } }

.medicine-source-actions {
  margin: 0 0 16px;
}

.medicine-camera {
  width: min(100%, 760px);
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
}

.medicine-camera video {
  display: block;
  width: 100%;
  max-height: 65vh;
  min-height: 220px;
  object-fit: contain;
  border-radius: 12px;
  background: #262626;
}

.medicine-camera p {
  margin: 12px 0 0;
  color: var(--text-main);
}

#medicine-status progress {
  display: block;
  width: 100%;
  height: 14px;
  margin: 12px 0 6px;
  accent-color: var(--primary-blue);
}

.medicine-error {
  margin-top: 16px;
}

@media (max-width: 560px) {
  .medicine-camera {
    padding: 12px;
  }

  .medicine-camera video {
    max-height: 55vh;
    min-height: 180px;
  }

  .medicine-camera .button-row button {
    flex: 1 1 100%;
  }
}

.mobile-nav,
.medicine-native-button {
  display: none;
}

.login-layout {
  grid-template-areas: "intro form";
}

.login-copy {
  grid-area: intro;
  grid-template-rows: auto;
  align-content: center;
}

.login-side-stack {
  grid-area: form;
  min-width: 0;
}

@media (pointer: coarse), (max-width: 960px) {
  .medicine-native-button {
    display: inline-flex;
  }
}

@media (max-width: 960px) {
  body[data-mode="login"] .app-shell {
    align-content: start;
  }

  .login-layout {
    grid-template-areas: "intro" "form";
    grid-template-rows: auto auto;
    align-content: start;
    gap: 14px;
  }

  .login-copy {
    min-height: 0;
    padding: 20px;
  }

  .login-copy h1 {
    font-size: clamp(28px, 7vw, 40px);
  }

  .login-copy .lead {
    margin-bottom: 0;
    font-size: 17px;
  }

  .layout .side {
    display: none;
  }

  .layout {
    --mobile-nav-space: calc(72px + env(safe-area-inset-bottom, 0px));
    padding-bottom: var(--mobile-nav-space);
    align-content: start;
  }

  .layout .content {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: #f5faff;
    box-shadow: 0 -6px 24px rgba(21, 78, 111, 0.12);
  }

  .mobile-nav button,
  body[data-mode="elder"] .mobile-nav button,
  .mobile-nav summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    min-height: 52px;
    padding: 4px;
    border: 0;
    border-radius: 12px;
    color: var(--text-main);
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-nav > button,
  .mobile-nav summary {
    flex-direction: column;
  }

  .mobile-nav summary {
    list-style: none;
  }

  .mobile-nav summary::-webkit-details-marker {
    display: none;
  }

  .mobile-nav .nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
  }

  .mobile-nav .active,
  body[data-mode="elder"] .mobile-nav button.active,
  .mobile-nav-more[open] summary {
    color: var(--primary-blue-strong);
    background: #e1eefa;
  }

  .mobile-nav-menu {
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    bottom: 100%;
    width: min(300px, calc(100% - 16px));
    max-height: min(50vh, 360px);
    margin-bottom: 8px;
    padding: 8px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f5faff;
    box-shadow: var(--shadow-soft);
  }

  .mobile-nav-menu button,
  body[data-mode="elder"] .mobile-nav-menu button {
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 12px;
    font-size: 16px;
  }

  body:is([data-mode="elder"], [data-mode="family"], [data-mode="community"]) .toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 560px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  }

  .login-layout {
    grid-template-areas: "form";
    grid-template-rows: auto;
  }

  .login-copy {
    display: none;
  }

  .brand {
    gap: 8px;
    white-space: nowrap;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 20px;
  }

  .brand strong {
    font-size: 18px;
  }

  .brand small,
  .session > span,
  body[data-mode="landing"] .topbar .auth-actions,
  body[data-mode="login"] .topbar .auth-actions {
    display: none;
  }

  .session {
    min-width: 0;
    gap: 6px;
  }

  .session b {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .session .icon-btn {
    width: auto;
    min-width: 54px;
    flex-shrink: 0;
    padding-inline: 8px;
  }

  body[data-mode="elder"] .session .icon-btn {
    min-height: 44px;
    font-size: 16px;
  }

  .landing-copy h1 {
    font-size: clamp(34px, 10vw, 48px);
  }

  .content,
  .field,
  .button-row > *,
  input,
  select,
  textarea {
    min-width: 0;
    max-width: 100%;
  }

  .content,
  .login-card {
    overflow-wrap: anywhere;
  }

  .primary,
  .secondary,
  .danger,
  .plain,
  .auth-tabs button {
    min-height: 48px;
    white-space: normal;
  }

  body[data-mode="elder"] {
    font-size: 20px;
  }

  body[data-mode="elder"] h2,
  body[data-mode="elder"] .dashboard-hero h2 {
    font-size: clamp(25px, 6.5vw, 34px);
  }

  body[data-mode="elder"] h3 {
    font-size: 23px;
  }

  body[data-mode="elder"] .dashboard p,
  body[data-mode="elder"] .panel p,
  body[data-mode="elder"] .action-tile span {
    font-size: 18px;
    line-height: 1.55;
  }

  body[data-mode="elder"] .dashboard .small,
  body[data-mode="elder"] .panel .small {
    font-size: 16px;
  }

  body[data-mode="elder"] .content button,
  body[data-mode="elder"] .field input,
  body[data-mode="elder"] .field select {
    min-height: 54px;
    font-size: 19px;
  }

  body[data-mode="elder"] .field textarea {
    min-height: 118px;
    font-size: 19px;
  }

  body[data-mode="elder"] .action-tile {
    min-height: 88px;
    padding: 14px 16px;
  }

  body[data-mode="elder"] .action-tile b {
    font-size: 23px;
  }

  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-scroll {
    max-width: 100%;
    overflow-x: auto;
  }

  .table-scroll .table {
    min-width: 420px;
  }

  .medicine-camera video {
    min-height: 0;
    max-height: min(48dvh, 320px);
    aspect-ratio: 4 / 3;
  }

  .toast {
    right: 12px;
    left: 12px;
    width: auto;
  }
}
