:root {
  --primary: #1F7A76;
  --primary-deep: #145C59;
  --primary-soft: #EAF4F3;
  --primary-line: #D3E5E3;
  --accent: #0F62A8;
  --accent-deep: #0A4A80;
  --accent-soft: #E3EDF7;
  --accent-line: #BFD6EA;
  --bg: #F8FAF9;
  --card: #FFFFFF;
  --line: #E7ECEB;
  --line-soft: #F0F4F3;
  --ink: #17221F;
  --ink-2: #5A6B67;
  --ink-3: #94A29F;
  --danger: #B84A46;
  --warn-soft: #FBF4E8;
  --fs: 17px;
  --fs-hint: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #DDE7E3;
  -webkit-font-smoothing: antialiased;
}

body { display: flex; justify-content: center; align-items: center; }

/* 手机壳容器：桌面居中带阴影，手机全屏 */
.app {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 520px) {
  body { background: linear-gradient(160deg, #E9F1EC 0%, #D6E4DC 100%); }
  .app {
    height: min(860px, 94vh);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(23, 34, 31, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.6);
  }
}

.view { flex: 1; min-height: 0; overflow: hidden; position: relative; }

/* ---------- 通用 ---------- */
.eyebrow {
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 0.5px;
  font-family: "Snell Roundhand", "Apple Chancery", "Segoe Script", Georgia, serif;
  font-style: italic;
}

.h1 { font-size: 24px; font-weight: 400; line-height: 1.35; margin-top: 8px; }
.head { padding: 24px 20px 18px; }

.btn {
  display: flex; align-items: center; justify-content: center;
  height: 52px; border-radius: 12px; font-size: 17px; font-weight: 500;
  border: none; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { opacity: 0.86; }
.btn-ghost { background: #fff; color: var(--primary-deep); border: 1px solid var(--line); }

/* ---------- 主页 ---------- */
.home { position: absolute; inset: 0; overflow-y: auto; background: #DCEBE1; }
.home-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.home-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(248,250,249,.78) 0%, rgba(248,250,249,.30) 34%,
    rgba(248,250,249,.44) 72%, rgba(248,250,249,.62) 100%);
}
.home-body {
  position: relative;
  z-index: 1;
  min-height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 44px 22px 22px;
}

.brand {
  font-size: 19px; color: var(--primary-deep);
  font-family: "Snell Roundhand", "Apple Chancery", "Segoe Script", Georgia, serif;
  font-style: italic;
}
.greet { font-size: 27px; font-weight: 400; line-height: 1.3; margin-top: 9px; }

/* 面板上下 auto 留白 → 自动落在屏幕垂直中间 */
.panel {
  margin: auto 0;
  padding: 28px 16px 22px;
  background: rgba(255, 255, 255, 0.56);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px; box-shadow: 0 6px 22px rgba(23, 34, 31, 0.07);
}
.hero-entry {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 18px;
}
.hero-circle {
  width: 86px; height: 86px; border-radius: 50%; background: rgba(255,255,255,.94);
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
  box-shadow: 0 4px 13px rgba(20, 92, 89, 0.13); transition: transform .18s ease;
  position: relative; z-index: 2; cursor: pointer;
}
.hero-circle:active { transform: scale(0.95); }
.hero-title { font-size: 17px; font-weight: 400; position: relative; z-index: 2; cursor: pointer; }

/* 两侧手绘线稿：淡黑、放大、向中间靠。可点，点了只跳一下 */
.hero-figure {
  position: absolute;
  bottom: 16px;
  width: 90px;
  height: 106px;
  color: #46524E;          /* 比正文黑淡一档 */
  opacity: 0.86;
  z-index: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 100%;
}
.hero-figure.l { left: 16px; }
.hero-figure.r { right: 16px; }

/* 点一下轻轻跳起来，幅度小，不打断视线 */
@keyframes figure-jump {
  0%   { transform: translateY(0) scaleY(1); }
  30%  { transform: translateY(-7px) scaleY(1.02); }
  62%  { transform: translateY(1px) scaleY(0.99); }
  100% { transform: translateY(0) scaleY(1); }
}
.hero-figure.jump {
  animation: figure-jump 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@media (max-width: 360px) {
  .hero-figure {
    width: 64px;
    height: 76px;
    bottom: 24px;
    color: #4C5854;
    opacity: 0.82;
  }
  .hero-figure.l { left: 6px; }
  .hero-figure.r { right: 6px; }
}
.panel-line { height: 1px; background: rgba(23,34,31,.08); margin: 0 8px 20px; }

.tools { display: flex; }
.tool { flex: 1; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.tool-circle {
  position: relative; width: 59px; height: 59px; border-radius: 50%;
  background: rgba(255,255,255,.88); border: 1px solid rgba(255,255,255,.9);
  display: flex; align-items: center; justify-content: center; margin-bottom: 9px;
  transition: transform .18s ease;
}
.tool:active .tool-circle { transform: scale(0.94); }
.tool span { font-size: 13px; }
.badge {
  position: absolute; top: -2px; right: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(255,255,255,.92);
}
.home-foot { text-align: center; font-size: 11.5px; color: #5F7268; padding: 26px 0 6px; }

/* 图标 */
.ic { position: relative; display: block; }
.ic-chat { width: 23px; height: 19px; border: 2px solid var(--primary-deep); border-radius: 7px 7px 7px 2.5px; }
.ic-chat::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 3px; height: 3px; border-radius: 50%;
  background: var(--primary-deep); transform: translate(-50%,-50%);
  box-shadow: -6.5px 0 0 var(--primary-deep), 6.5px 0 0 var(--primary-deep);
}
.ic-box { width: 26px; height: 13px; border: 2px solid var(--primary-deep); border-radius: 999px; transform: rotate(-38deg); }
.ic-box::after { content: ''; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 2px; background: var(--primary-deep); transform: translateX(-50%); }
.ic-calendar { width: 21px; height: 19px; border: 2px solid var(--primary-deep); border-radius: 4px; }
.ic-calendar::before { content: ''; position: absolute; left: -2px; right: -2px; top: 4px; height: 2px; background: var(--primary-deep); }
.ic-calendar::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; border-radius: 1px; background: var(--primary-deep); transform: translateX(-50%); }
.ic-safety { width: 19px; height: 21px; border: 2px solid var(--primary-deep); border-radius: 4px 4px 50% 50%; }

/* ---------- 内页通用头部 ---------- */
.navbar {
  height: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  position: relative; font-size: 16px; font-weight: 500; background: var(--bg);
  border-bottom: 1px solid transparent;
}
.navbar .back {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 22px; color: var(--primary-deep); padding: 6px 10px; cursor: pointer;
  line-height: 1;
}

/* ---------- 问答 ---------- */
.chat-page { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.msg-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 20px; }

.intro { padding-top: 18px; }
.intro-title { font-size: 25px; font-weight: 400; line-height: 1.35; margin-top: 10px; }
.intro-sub { font-size: 17px; color: var(--ink-2); line-height: 1.7; margin-top: 10px; }
.quick { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.quick-item {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 15px 14px; font-size: 17px; line-height: 1.5; cursor: pointer;
}
.quick-item:active { background: #F2F7F5; }
.intro-foot { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 26px; }

.msg { display: flex; align-items: flex-start; margin-bottom: 20px; }
.msg.user { justify-content: flex-end; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
  margin-right: 10px; flex-shrink: 0; margin-top: 3px;
}
.bubble-col { flex: 1; min-width: 0; }
.bubble { border-radius: 12px; padding: 15px 16px; font-size: 18px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.bubble.ai { background: #EBF2FB; border-top-left-radius: 4px; }
.bubble.ai.urgent { background: #DCE9F9; }
.bubble.ai.failed { background: var(--warn-soft); }
.bubble.user { background: #2E827C; color: #fff; max-width: 82%; border-top-right-radius: 4px; }

.bubble-actions { display: flex; gap: 18px; margin-top: 8px; }
.bubble-action { font-size: 13.5px; color: var(--ink-3); cursor: pointer; }
.bubble-action:active { color: var(--primary); }

.sources { margin-top: 4px; padding-left: 2px; }
.source { display: flex; align-items: center; padding: 3px 0; cursor: pointer; }
.source-idx { flex-shrink: 0; font-size: 11px; color: var(--accent); margin-right: 5px; line-height: 1.6; }
.source-site { font-size: 13px; color: var(--accent); line-height: 1.6; }

.sending { display: flex; align-items: center; gap: 5px; height: 20px; color: var(--ink-3); font-size: 14px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

.composer {
  flex-shrink: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 8px 16px 14px; display: flex; align-items: center;
}
.mic {
  width: 43px; height: 43px; border-radius: 50%; background: var(--primary); flex-shrink: 0;
  margin-right: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; border: none; padding: 0;
}
.mic.rec { background: var(--danger); }
.mic-core { width: 9px; height: 13px; border: 1.5px solid #fff; border-radius: 4.5px; }
.mic-foot { width: 1.5px; height: 4px; background: #fff; margin-top: 1.5px; border-radius: 1px; }
.cinput {
  flex: 1; height: 39px; background: #F4F7F6; border-radius: 8px; border: none;
  padding: 0 12px; font-size: 16px; color: var(--ink); font-family: inherit; outline: none; min-width: 0;
}
.cinput::placeholder { color: var(--ink-3); }
.send {
  width: 56px; height: 39px; border-radius: 8px; background: #EFF3F2; color: var(--ink-3);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  margin-left: 7px; flex-shrink: 0; border: none; cursor: pointer; font-family: inherit;
}
.send.on { background: #2E827C; color: #fff; }

/* ---------- 药箱 ---------- */
.page-scroll { height: 100%; overflow-y: auto; }
.box-page { padding: 0 20px 30px; }
.actions { display: flex; gap: 10px; margin-bottom: 20px; }
.act {
  flex: 1; min-height: 64px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 500;
  color: var(--primary-deep); cursor: pointer;
}
/* 添加药品：浅一点的绿 + 白字，无边框 */
.act.primary {
  background: #2E827C;
  border-color: transparent;
  color: #FFFFFF;
}
.act.primary:active { background: #23706A; }
.med-card {
  display: flex; align-items: flex-start; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 15px; margin-bottom: 8px;
}
.med-main { flex: 1; min-width: 0; padding-right: 10px; }
.med-name { font-size: 18px; font-weight: 400; line-height: 1.4; margin-bottom: 5px; }
.med-meta { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.med-usage { font-size: 14px; color: var(--primary); line-height: 1.5; }
.med-side { display: flex; flex-direction: column; align-items: flex-end; }
.med-tag { font-size: 11.5px; color: var(--primary); background: var(--primary-soft); border-radius: 4px; padding: 3px 7px; margin-bottom: 6px; }
.med-del { font-size: 12px; color: var(--ink-3); cursor: pointer; padding: 4px 0; }
.empty { text-align: center; color: var(--ink-3); font-size: 16px; padding: 50px 0; line-height: 1.8; }

/* ---------- 日历 ---------- */
.cal-page { display: flex; flex-direction: column; height: 100%; }
.cal-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px; }
.month-bar { display: flex; align-items: center; justify-content: space-between; padding: 18px 4px 12px; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  font-size: 23px; line-height: 1; display: flex; align-items: center; justify-content: center;
  padding-bottom: 3px; cursor: pointer; border: none; font-family: inherit;
}
.nav-btn.disabled { opacity: 0.28; pointer-events: none; }
.month-label { font-size: 19px; font-weight: 400; }
.week-head { display: flex; padding-bottom: 5px; }
.week-head span { flex: 1; text-align: center; font-size: 12px; color: var(--ink-3); }
.grid { display: flex; flex-wrap: wrap; padding-bottom: 20px; }
.cell {
  width: 14.2857%; height: 56px; display: flex; flex-direction: column;
  align-items: center; padding-top: 4px;
}
.cell .day {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-size: 15px; border-radius: 50%; line-height: 1;
}
.cell.muted .day { color: #C9D4D0; }
.cell.today .day { background: var(--primary); color: #fff; font-weight: 600; }
.dose {
  margin-top: 4px; min-width: 23px; height: 14px; padding: 0 4px; border-radius: 999px;
  background: #EDF1F0; color: var(--ink-3); font-size: 9px; line-height: 14px; text-align: center;
}
.dose.partial { background: var(--accent-soft); color: var(--accent); }
.dose.done { background: #D8EFE2; color: #1E7A4E; font-weight: 600; font-size: 10px; }

.checkin { flex-shrink: 0; background: #fff; border-top: 1px solid var(--line); padding: 16px 20px 18px; }
.ck-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 11px; }
.ck-date { font-size: 15px; color: var(--ink-2); }
.ck-count { font-size: 16px; font-weight: 400; color: var(--primary); }
.ck-dots { display: flex; gap: 6px; margin-bottom: 14px; }
.ck-dots i { flex: 1; height: 7px; border-radius: 999px; background: #E9EEEC; display: block; transition: background-color .25s; }
.ck-dots i.on { background: var(--primary); }
.ck-btn {
  width: 100%; height: 56px; border-radius: 10px; background: var(--primary); color: #fff;
  font-size: 19px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-family: inherit; transition: background-color .25s, color .25s;
}
.ck-btn.done { background: #D8EFE2; color: #1E7A4E; }
.ck-undo { text-align: center; font-size: 12px; color: var(--ink-3); padding-top: 11px; cursor: pointer; }

/* ---------- 我的 ---------- */
.profile-page { padding: 0 20px 30px; }
.section { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px; margin-bottom: 12px; }
.section-title { font-size: 19px; font-weight: 400; margin-bottom: 5px; }
.section-sub { font-size: 14px; color: var(--ink-3); line-height: 1.6; margin-bottom: 14px; }
.scale-row { display: flex; gap: 8px; margin-bottom: 12px; }
.scale-item {
  flex: 1; height: 74px; border: 1px solid var(--line); border-radius: 8px; background: #FBFCFC;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
}
.scale-item.on { border-color: var(--primary); background: var(--primary-soft); }
.scale-label { font-size: 11.5px; color: var(--ink-2); margin-top: 7px; }
.scale-item.on .scale-label { color: var(--primary-deep); font-weight: 500; }
.tagwrap { display: flex; flex-wrap: wrap; gap: 7px; }
.tagitem {
  padding: 9px 15px; border-radius: 6px; background: #F4F7F6; color: var(--ink-2);
  font-size: 14px; border: 1.5px solid transparent; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, transform .12s ease;
}
.tagitem:active { transform: scale(0.95); }
/* 选中＝实心绿，再点一下恢复浅灰 */
.tagitem.on {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}
.menu { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; min-height: 56px;
  border-bottom: 1px solid var(--line-soft); font-size: 17px; cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-tail { display: flex; align-items: center; color: var(--ink-3); font-size: 14px; }
.menu-val { color: var(--accent); margin-right: 6px; }
.foot-note { text-align: center; font-size: 11.5px; color: var(--ink-3); padding: 22px 0 6px; line-height: 1.7; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: relative; flex-shrink: 0; display: flex; align-items: center;
  background: #fff; border-top: 1px solid var(--line); height: 56px;
}
.indicator {
  position: absolute; top: 0; left: 0; width: 50%; height: 4px; display: flex;
  justify-content: center; pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.indicator i { width: 24px; height: 3px; border-radius: 0 0 2px 2px; background: var(--accent); display: block; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 11px; color: var(--ink-3); cursor: pointer;
  --g: var(--ink-3); transition: color .22s;
}
.tab.on { color: var(--accent); --g: var(--accent); }
.g-index {
  width: 15px; height: 15px; display: block;
  background-image:
    radial-gradient(circle, var(--g) 44%, transparent 46%),
    radial-gradient(circle, var(--g) 44%, transparent 46%),
    radial-gradient(circle, var(--g) 44%, transparent 46%),
    radial-gradient(circle, var(--g) 44%, transparent 46%);
  background-size: 6px 6px; background-position: 0 0, 9px 0, 0 9px, 9px 9px;
  background-repeat: no-repeat;
}
.g-profile { width: 13px; height: 13px; border: 1.5px solid var(--g); border-radius: 50%; display: block; }
.tab.on .g-profile { background: var(--g); }

.hidden { display: none !important; }
.tip { text-align: center; font-size: 12px; color: var(--ink-3); padding: 10px 0; }
