:root {
  --bg: #fff9ef;
  --surface: #fffefb;
  --fg: #51372b;
  --muted: #81695d;
  --border: #efd8c4;
  --accent: #e98b52;
  --accent-soft: #ffead8;
  --success: #78a66f;
  --warn: #e8a34d;
  --danger: #e45f78;
  --font-display: "SimHei", "黑体", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Microsoft YaHei", "PingFang SC", "Source Han Sans SC", "Noto Sans SC", system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 8px 28px rgb(120 78 48 / 0.10);
  --tap: 56px;
  --safe-b: 88px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: #f4eadc;
  color: var(--fg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

.app-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 0 1px var(--border), var(--shadow);
}

@media (min-width: 900px) {
  body { padding: 24px 0 48px; }
  .app-shell {
    min-height: calc(100vh - 72px);
    border-radius: 28px;
    overflow: hidden;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.topbar .sub {
  margin: 4px 0 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.4;
}
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn svg { width: 26px; height: 26px; stroke: var(--fg); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(0.97); }
.page-title-icon { display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;margin-right:10px;border-radius:12px;color:#fff;background:linear-gradient(145deg,var(--accent),#f4a56d);font-size:21px;vertical-align:middle;box-shadow:0 5px 14px rgb(235 133 77 / .2); }
.service-return { margin-top: 18px; }

.content {
  padding: 8px 20px calc(var(--safe-b) + 20px);
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }

.section-label {
  margin: 22px 0 12px;
  font-size: 18px;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 550;
  letter-spacing: 0.02em;
  transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--accent);
  color: oklch(0.99 0.01 85);
  box-shadow: 0 6px 18px rgb(233 139 82 / 0.28);
}
.btn-secondary {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--fg);
}
.btn-block { width: 100%; }
.btn-lg { min-height: 64px; font-size: 20px; border-radius: 18px; }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1.5px solid var(--border);
  z-index: 30;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.02em;
}
.tab svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* 老人端统一侧边抽屉：与子女端保持一致的信息架构 */
.elder-sidebar-trigger{width:44px;height:44px;display:grid;place-items:center;flex:0 0 auto;border-radius:13px;background:var(--surface);border:1.5px solid var(--border)}
.elder-sidebar-trigger svg,.elder-sidebar-menu svg{width:23px;height:23px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.elder-sidebar-mask{position:fixed;inset:0;z-index:100;background:rgba(39,31,27,.43);opacity:0;visibility:hidden;transition:.2s ease}
.elder-sidebar-mask.open{opacity:1;visibility:visible}.elder-sidebar{position:absolute;inset:0 auto 0 0;width:min(360px,88vw);display:flex;flex-direction:column;background:#fffdf9;box-shadow:14px 0 36px rgba(47,36,29,.2);transform:translateX(-102%);transition:transform .24s ease}
.elder-sidebar-mask.open .elder-sidebar{transform:translateX(0)}.elder-sidebar-head{padding:21px 18px 13px;border-bottom:1px solid var(--border)}
.elder-sidebar-search{height:50px;display:flex;align-items:center;gap:10px;padding:0 14px;border-radius:15px;background:#f6f2ed;color:var(--muted);font-size:16px}.elder-sidebar-search svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:2}
.elder-sidebar-user{display:flex;align-items:center;gap:12px;padding:18px 3px 6px}.elder-sidebar-avatar{width:44px;height:44px;display:grid;place-items:center;border-radius:50%;background:var(--accent-soft);color:var(--accent);font-size:20px;font-weight:800}.elder-sidebar-user strong{display:block;font-size:18px}.elder-sidebar-user span{display:block;margin-top:2px;color:var(--muted);font-size:13px}
.elder-sidebar-scroll{flex:1;overflow:auto;padding:10px 14px}.elder-sidebar-title{padding:14px 10px 7px;color:#a19389;font-size:14px}.elder-sidebar-menu{width:100%;min-height:56px;display:flex;align-items:center;gap:14px;padding:0 14px;border-radius:14px;text-align:left;font-size:17px;font-weight:700}.elder-sidebar-menu:hover,.elder-sidebar-menu.active{background:#fff0e3;color:var(--accent)}.elder-sidebar-menu span{flex:1}.elder-sidebar-menu .elder-sidebar-chevron{flex:0;color:#aaa;font-size:22px}
.elder-sidebar-footer{padding:12px 14px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--border)}.elder-sidebar-login{color:var(--accent)}.elder-sidebar-logout{color:#b5322b}.elder-sidebar-open{overflow:hidden}
body.elder-drawer-ui .topbar{gap:10px}body.elder-drawer-ui .tabbar{grid-template-columns:repeat(3,1fr)}body.elder-drawer-ui .tabbar .tab:nth-child(4),body.elder-drawer-ui .tabbar .tab:nth-child(5){display:none}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0.02em;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row .meta { flex: 1; min-width: 0; }
.list-row .title { font-size: 18px; font-weight: 550; margin: 0; }
.list-row .desc { margin: 4px 0 0; font-size: 15px; color: var(--muted); line-height: 1.4; }
.list-ico {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.list-ico svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chev { color: var(--muted); flex-shrink: 0; }
.chev svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.field label {
  font-size: 17px;
  font-weight: 550;
  letter-spacing: 0.02em;
}
.field input, .field select, .field textarea {
  min-height: var(--tap);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 0 16px;
  font: inherit;
  font-size: 18px;
  color: var(--fg);
}
.field textarea { min-height: 120px; padding: 14px 16px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 3px solid color-mix(in oklab, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--fg);
  color: var(--bg);
  padding: 16px 24px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 550;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 50;
  width: max-content;
  max-width: min(400px, calc(100% - 40px));
  text-align: center;
  box-shadow: 0 8px 28px rgb(81 55 43 / 0.15);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* —— 药品多剂量 —— */
.med-group {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.med-group:last-child { border-bottom: 0; }
.med-group h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
}
.med-dose {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 6px 0 6px 4px;
}
.med-dose + .med-dose {
  border-top: 1px dashed var(--border);
}
.med-dose span {
  font-size: 16px;
  color: var(--muted);
}
.med-dose .toggle-done {
  min-width: 80px;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.med-dose .toggle-done.on {
  background: color-mix(in oklab, var(--success) 18%, white);
  border-color: color-mix(in oklab, var(--success) 40%, var(--border));
  color: var(--success);
}
.dose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: end;
}
.dose-row .field:last-child { grid-column: 1 / -1; }
.sheet-panel { max-width: calc(100vw - 24px); overflow-x: hidden; box-sizing: border-box; }
.dose-row:last-child { border-bottom: 0; }
.dose-row .field { margin-bottom: 0; }
.dose-row .field label { font-size: 14px; }
.dose-row .field input,
.dose-row .field select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 48px;
  font-size: 16px;
  padding: 0 12px;
}
@media (max-width: 520px) {
  .dose-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dose-row .field:last-child { grid-column: 1 / -1; }
}

/* —— 个性化设置 —— */
.color-preset {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.color-preset button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.color-preset button.on {
  border-color: var(--fg);
  transform: scale(1.1);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* —— 浮动 AI 挂件（全局可拖拽 / 可关闭） —— */
.float-ai {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  touch-action: none;
  user-select: none;
  right: max(8px, calc((100vw - 430px) / 2 + 8px));
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  transition: opacity .25s ease, transform .25s ease;
}
.float-ai.dismissed {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}
.float-ai-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--accent), color-mix(in oklab, var(--accent) 80%, oklch(0.99 0.01 85)));
  border: 2px solid oklch(0.99 0.01 85);
  box-shadow: 0 8px 24px rgb(233 139 82 / 0.28);
  display: grid;
  place-items: center;
  cursor: grab;
  position: relative;
  transition: transform .15s ease;
}
.float-ai-avatar:active { cursor: grabbing; }
.float-ai-avatar svg {
  width: 30px; height: 30px;
  stroke: oklch(0.99 0.01 85);
  fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* 保持设计稿原始布局，仅按用户指定图片替换悬浮小伴图形 */
.float-ai-avatar {
  background: #fff url('companion.png') center / cover no-repeat;
  border-radius: 50%;
}
.float-ai-avatar > svg { opacity: 0; }

/* 小伴动态形象：轻柔呼吸与漂浮，不干扰长辈阅读 */
.ai-avatar,
.float-ai-avatar {
  animation: companion-breathe 3.2s ease-in-out infinite;
  transform-origin: 50% 70%;
}
.float-ai-avatar::before {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  border: 2px solid rgb(233 139 82 / .26);
  border-radius: 50%;
  animation: companion-halo 2.6s ease-out infinite;
}
body.companion-active .ai-avatar,
body.companion-active .float-ai-avatar { animation: companion-listening .75s ease-in-out infinite alternate; }
@keyframes companion-breathe {
  0%, 100% { transform: translateY(0) rotate(-1deg) scale(1); }
  50% { transform: translateY(-4px) rotate(1deg) scale(1.035); }
}
@keyframes companion-halo {
  0% { opacity: .75; transform: scale(.88); }
  75%, 100% { opacity: 0; transform: scale(1.18); }
}
@keyframes companion-listening {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-5px) scale(1.07); }
}

.elder-profile-card { padding: 18px; }
.profile-help { margin: 0 0 16px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.elder-profile-form { display: grid; gap: 15px; }
.elder-profile-form label { display: grid; gap: 8px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.elder-profile-form input,
.elder-profile-form select,
.elder-profile-form textarea {
  width: 100%; min-height: 52px; border: 1.5px solid var(--border); border-radius: 15px;
  background: var(--surface); color: var(--fg); padding: 12px 14px; font: inherit; font-size: 16px;
}
.elder-profile-form textarea { resize: vertical; min-height: 82px; line-height: 1.55; }
.elder-profile-form input:focus,
.elder-profile-form select:focus,
.elder-profile-form textarea:focus { outline: 3px solid color-mix(in oklab, var(--accent) 25%, transparent); border-color: var(--accent); }
.profile-fields { display: grid; gap: 12px; }
.profile-fields.two-columns { grid-template-columns: 1.35fr .65fr; }
@media (max-width: 370px) { .profile-fields.two-columns { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .ai-avatar, .float-ai-avatar, .float-ai-avatar::before { animation: none !important; }
}

/* 三主页面信息架构 */
.primary-chat-page .chat-shell { min-height: 100vh; }
.primary-chat-page [data-od-id="chat-back"],
.primary-chat-page .quick { display: none; }
.companion-topbar {
  min-height: 88px;
  padding-block: 12px;
  border-bottom: 1.5px solid var(--border);
}
.companion-heading { display:flex; align-items:center; gap:13px; min-width:0; }
.companion-heading-avatar {
  width:58px; height:58px; border-radius:50%; object-fit:cover; flex:0 0 auto;
  background:var(--surface); border:1.5px solid var(--border); box-shadow:0 5px 14px rgb(120 78 48 / .12);
}
.companion-heading .sub { font-size:14px; margin-top:3px; }
.companion-heading h1 { font-size:22px; }
.primary-chat-page .chat-body {
  min-height:calc(100vh - 88px);
  padding:18px 16px calc(var(--tabbar-height, var(--safe-b)) + 114px);
  gap:18px;
}
.primary-chat-page .bubble-row { align-items:flex-start; }
.primary-chat-page .bubble-row.me { flex-direction:row; justify-content:flex-end; }
.primary-chat-page .bubble {
  max-width:100%; border-radius:15px; padding:13px 15px;
  box-shadow:0 3px 10px rgb(120 78 48 / .07);
}
.primary-chat-page .bubble-row.me .bubble {
  background:var(--accent);
  color:#fff;
  border-color:transparent;
}
.message-stack {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  max-width:calc(100% - 64px);
  min-width:0;
}
.bubble-row.me .message-stack { align-items:flex-end; }
.primary-chat-page .time-sep {
  align-self:center;
  width:max-content;
  max-width:80%;
  margin:5px auto;
  padding:5px 10px;
  border-radius:8px;
  background:color-mix(in oklab, var(--fg) 8%, transparent);
  color:var(--muted);
  font-size:13px;
  line-height:1.2;
  letter-spacing:0;
}
.primary-chat-page .bot-dot {
  width:48px; height:48px; border-radius:50%; overflow:hidden; font-weight:700;
  background:var(--surface) url('companion.png') center / cover no-repeat; color:transparent;
}
.user-avatar {
  width:48px; height:48px; border-radius:13px; overflow:hidden; flex:0 0 auto;
  display:grid; place-items:center; color:#fff; font-size:17px; font-weight:700;
  background:linear-gradient(145deg,var(--accent),#f4ad78); border:1.5px solid var(--border);
}
.user-avatar img { width:100%; height:100%; object-fit:cover; }
.primary-voice-wrap {
  position:fixed; left:50%; transform:translateX(-50%); bottom:var(--tabbar-height, var(--safe-b));
  z-index:28; width:min(430px,100%); height:94px; padding:5px 14px;
  display:flex; justify-content:center; align-items:center; pointer-events:none;
  transition:.2s ease;
}
.primary-voice-btn {
  width: 88px; height: 88px; border-radius: 50%; color: #fff; background: var(--accent);
  border: 4px solid var(--surface); box-shadow: 0 9px 26px rgb(233 139 82 / .30);
  display: grid; place-items: center; align-content: center; gap: 5px; font-size: 15px; font-weight: 700; pointer-events:auto;
  transition:width .2s ease,height .2s ease;
}
.primary-voice-btn svg { width: 31px; height: 31px; stroke: currentColor; fill: none; stroke-width: 2; }
.primary-voice-btn.listening { background: var(--danger); animation: voice-pulse .8s ease-in-out infinite alternate; }
.bubble.voice-transcribing {
  opacity: 0.78;
  outline: 2px dashed color-mix(in oklab, currentColor 35%, transparent);
}
@keyframes voice-pulse { to { transform: scale(1.08); box-shadow: 0 0 0 12px rgb(228 95 120 / .14); } }
.primary-chat-page .composer {
  bottom:var(--tabbar-height, var(--safe-b)); width:min(430px,100%); height:94px;
  display:flex; justify-content:flex-end; align-items:center;
  padding:8px 14px; background:color-mix(in oklab,var(--bg) 94%,transparent);
  border-top:1.5px solid var(--border); backdrop-filter:blur(10px);
}
.primary-chat-page #voice-btn { display: none; }
.primary-chat-page .composer input {
  display:none; width:100%;
  min-width: 0;
  min-height:58px; padding-inline:16px; border-radius:15px;
}
.primary-chat-page .composer .send {
  display:none; width:58px; height:58px; border-radius:15px;
}
.text-input-toggle {
  width:58px; height:58px; border-radius:15px; border:1.5px solid var(--border);
  background:var(--surface); display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:2px; color:var(--fg); box-shadow:0 4px 13px rgb(120 78 48 / .08);
}
.text-input-toggle svg { width:25px; height:25px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.text-input-toggle span { font-size:11px; font-weight:700; }
.text-input-open .primary-voice-wrap { justify-content:flex-start; padding-left:60px; }
.text-input-open .primary-voice-btn { width:62px; height:62px; font-size:12px; }
.text-input-open .primary-voice-btn svg { width:27px; height:27px; }
.text-input-open .primary-voice-btn span { display:none; }
.text-input-open.primary-chat-page .composer {
  padding-left:130px;
  display:grid;
  grid-template-columns:minmax(0,1fr) 56px;
  gap:7px;
}
.text-input-open.primary-chat-page .composer input,
.text-input-open.primary-chat-page .composer .send { display:flex; }
.text-input-open .text-input-toggle {
  display:flex;
  position:absolute;
  left:8px;
  top:18px;
  width:44px;
  height:58px;
}
.text-input-open .text-input-toggle span { display:none; }
.text-input-open.primary-chat-page .composer input { order:1; }
.text-input-open.primary-chat-page .composer .send { order:2; width:56px; }
.primary-chat-page .composer .send svg { transform: rotate(-90deg); }
.primary-chat-page .composer .send[disabled] { opacity:.55; cursor:wait; }
.primary-chat-page .float-ai { display:none; }

.avatar-upload-row { align-items:flex-start; flex-wrap:wrap; }
.avatar-upload-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px; width:100%; }
.avatar-upload-actions .btn { min-height:44px; padding-inline:14px; font-size:15px; }
.avatar-remove-btn { min-height:40px; padding:0 10px; color:var(--danger); font-size:14px; }
.avatar-file-input {
  display:block;
  flex:1 1 220px;
  min-width:0;
  min-height:48px;
  padding:6px;
  border:1.5px solid var(--border);
  border-radius:13px;
  background:var(--surface);
  color:var(--fg);
  font:inherit;
  font-size:14px;
}
.avatar-file-input::file-selector-button {
  min-height:34px;
  margin-right:8px;
  padding:0 12px;
  border:0;
  border-radius:9px;
  background:var(--accent);
  color:#fff;
  font:inherit;
}
.username-setting-row { align-items:flex-start; flex-wrap:wrap; }
.username-edit-actions { display:grid; grid-template-columns:minmax(0,1fr) 72px; gap:8px; width:100%; }
.username-edit-actions .contact-input { margin:0; min-width:0; }
.username-edit-actions .btn { min-height:52px; padding:0 12px; font-size:16px; }
.user-settings-card { display:grid; gap:12px; }
.user-settings-card .btn { margin-top:0; }
.user-settings-select-label { display:grid; gap:8px; font-size:17px; font-weight:650; }
.user-settings-select-label select {
  width:100%; min-height:52px; padding:0 14px; border:1.5px solid var(--border);
  border-radius:14px; background:var(--surface); color:var(--fg); font:inherit; font-size:17px;
}
.family-member-list { display:grid; gap:8px; }
.family-member-item {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  min-height:54px; padding:10px 12px; border:1.5px solid var(--border);
  border-radius:13px; background:var(--bg);
}
.family-member-item { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.family-member-item strong { margin-right:auto; }
.family-member-actions { display:flex; gap:6px; }
.family-member-actions button { min-height:38px; padding:0 12px; border-radius:10px; border:1px solid var(--border); background:var(--surface); color:var(--text); font:inherit; }
.family-member-actions .delete { color:var(--danger); }
.family-member-editor { margin-top:12px; padding:14px; border:1.5px solid var(--border); border-radius:16px; background:var(--bg); }
.family-member-editor label { display:block; margin-bottom:12px; font-weight:600; }
.family-member-editor-actions { display:flex; gap:10px; }
.family-member-editor-actions .btn { flex:1; }
.family-member-item strong { font-size:17px; }
.family-member-item span { color:var(--muted); font-size:14px; }
.family-member-item.active { border-color:var(--accent); background:var(--accent-soft); }
.family-code-result {
  display:none; margin:0; padding:14px; border-radius:13px;
  background:var(--accent-soft); color:var(--fg); font-size:18px; font-weight:700; text-align:center;
}
.family-code-result.show { display:block; }
.user-settings-action { margin-top:14px; }
@media (max-width:370px) {
  .primary-chat-page .chat-body { padding-inline:12px; }
  .text-input-open.primary-chat-page .composer {
    padding-left:112px;
    padding-right:8px;
    grid-template-columns:minmax(0,1fr) 50px;
    gap:5px;
  }
  .text-input-open .primary-voice-wrap { padding-left:48px; }
  .text-input-open .primary-voice-btn { width:56px; height:56px; }
  .text-input-open .text-input-toggle { left:5px; width:38px; height:54px; top:20px; }
  .text-input-open.primary-chat-page .composer .send { width:50px; height:54px; }
  .text-input-open.primary-chat-page .composer input { min-height:54px; padding-inline:10px; }
}

.service-page { padding-top: 14px; }
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.service-entry {
  min-height: 154px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; padding: 16px; text-align: center; border-radius: 22px; border: 1.5px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow);
}
.service-entry:active { transform: scale(.98); }
.service-entry .service-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: #fff; font-size: 29px; }
.service-entry strong { font-size: 19px; }
.service-entry small { color: var(--muted); font-size: 13px; }
.service-entry.health .service-icon { background:#e96f86; }.service-entry.meds .service-icon { background:#f0a064; }
.service-entry.family .service-icon { background:#df8b57; }.service-entry.community .service-icon { background:#e5a34e; }
.service-entry.games .service-icon { background:#e77791; }.service-entry.fun .service-icon { background:#ef8b61; }
.family-list { display: grid; gap: 10px; }
.family-contact-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.family-contact-row:last-child { border-bottom: 0; }.family-contact-row .meta { flex: 1; }
.family-contact-row strong,.family-contact-row span { display: block; }.family-contact-row span { color:var(--muted);margin-top:4px; }
.family-contact-row button { color: var(--danger); min-height: 44px; padding: 0 10px; }
.phone-link { color:var(--accent); margin-top:5px; text-decoration:underline; text-underline-offset:3px; }
.call-contact-btn { min-height:44px; padding:0 13px; display:grid; place-items:center; border-radius:12px; background:var(--accent); color:#fff; font-weight:700; }
.emergency-service-btn { display:block; width:100%; margin-top:18px; min-height:64px; border-radius:18px; background:var(--danger); color:#fff; font-weight:700; font-size:18px; touch-action:none; user-select:none; -webkit-user-select:none; }
.emergency-service-btn.holding { background:linear-gradient(90deg,#b93c36 var(--hold-progress,0%),var(--danger) var(--hold-progress,0%)); }
.tabbar { grid-template-columns: repeat(3, 1fr); }
.secondary-settings-block { display: none !important; }
.tabbar .nav-symbol { display:block; font-size:24px; line-height:1; margin-bottom:4px; }
.brain-game-menu { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }
.brain-game-menu button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
#memory-game-panel { margin-top: 18px; }
.external-app-launcher {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: oklch(0.2 0.02 45 / 0.5);
}
.external-app-card {
  width: min(380px, 100%);
  padding: 24px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.external-app-card strong { font-size: 24px; }
.external-app-card p { color: var(--muted); line-height: 1.6; }
.brain-game-menu button { min-height:52px; border:1.5px solid var(--border); border-radius:14px; background:var(--accent-soft); color:var(--fg); font-weight:700; }
.brain-game-lab:not(:empty) { margin-top:16px; padding:16px; border:1.5px solid var(--border); border-radius:16px; background:var(--bg); text-align:center; }
.brain-number { font-size:40px; letter-spacing:.18em; font-weight:700; color:var(--accent); margin:12px 0; }
.mini-answer { display:flex; gap:8px; margin-top:12px; }.mini-answer input { min-width:0; flex:1; min-height:48px; border:1.5px solid var(--border); border-radius:12px; padding:0 12px; font:inherit; }
.mini-answer button,.game-choice { min-height:48px; padding:0 14px; border-radius:12px; background:var(--accent); color:#fff; font-weight:700; }
.tiny-board { display:grid; grid-template-columns:repeat(3,64px); justify-content:center; gap:6px; margin:14px 0; }
.tiny-board button { width:64px;height:64px;border:1.5px solid var(--border);border-radius:12px;background:var(--surface);font-size:28px;font-weight:700; }
.difference-row { display:flex;justify-content:center;gap:10px;margin:14px 0; }.difference-row button { width:58px;height:58px;border-radius:14px;background:var(--surface);border:1.5px solid var(--border);font-size:28px; }
.float-ai-close {
  position: absolute;
  top: -8px; right: -8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  border: 2px solid var(--bg);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
}
.float-ai-bubble {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 8px 28px oklch(0.35 0.03 45 / 0.12);
  max-width: 220px;
  display: none;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  pointer-events: auto;
  position: relative;
}
.float-ai-bubble.open { display: block; }
.float-ai-bubble strong { font-weight: 600; }
.float-ai-conversation { max-height:180px; overflow:auto; line-height:1.5; }
.float-ai-user { margin-bottom:8px; color:var(--accent); font-weight:600; }
.float-ai-answer { color:var(--text); }
.daily-checkin-overlay { position:fixed; inset:0; z-index:1200; display:grid; place-items:center; padding:24px; background:rgb(65 42 30 / .34); backdrop-filter:blur(4px); }
.daily-checkin-card { width:min(330px,90vw); padding:28px 20px; border-radius:28px; background:var(--surface); border:1.5px solid var(--border); box-shadow:0 20px 55px rgb(64 38 22 / .24); text-align:center; }
.daily-checkin-card h2 { margin:0 0 8px; font-size:26px; }.daily-checkin-card p { margin:0 0 20px; color:var(--muted); line-height:1.6; }
.daily-checkin-button { width:150px; height:150px; border:8px solid #fff; border-radius:50%; background:linear-gradient(145deg,#f5a261,#e9783f); color:#fff; box-shadow:0 12px 28px rgb(233 120 63 / .34); font-size:28px; font-weight:750; }
.daily-checkin-button:active { transform:scale(.97); }.daily-checkin-button[disabled] { opacity:.75; }
.float-ai-chat-link {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}
.float-ai-bubble .mini-input {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.float-ai-bubble .mini-input input {
  flex: 1;
  min-height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  min-width: 0;
}
.float-ai-bubble .mini-input button {
  min-height: 36px;
  min-width: 36px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  display: grid;
  place-items: center;
  color: oklch(0.99 0.01 85);
}
.float-ai-bubble .mini-input button svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
