:root {
  --bg: #f4f0e6;
  --bg-deep: #ece5d7;
  --surface: #fffdf8;
  --surface-2: #faf6ed;
  --surface-3: #f3eddf;
  --ink: #1d2a24;
  --ink-soft: #3d4b44;
  --muted: #707c74;
  --muted-2: #98a29b;
  --line: #e2dbcc;
  --line-strong: #d1c7b4;
  --green: #235d46;
  --green-deep: #173f30;
  --green-mid: #36755a;
  --green-soft: #e2ece5;
  --green-pale: #eff5ef;
  --amber: #b97437;
  --amber-deep: #8d5526;
  --amber-soft: #f6e7d3;
  --amber-pale: #fbf3e7;
  --blue-soft: #e6edf2;
  --rose: #a64f43;
  --rose-soft: #f8e6e2;
  --shadow: 0 1px 2px rgba(38, 46, 39, .04), 0 18px 44px -26px rgba(38, 46, 39, .24);
  --shadow-soft: 0 1px 2px rgba(38, 46, 39, .03), 0 10px 26px -20px rgba(38, 46, 39, .2);
  --radius: 18px;
  --radius-lg: 26px;
  --radius-sm: 12px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --num: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --ease: cubic-bezier(.2, .7, .25, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 620px at 92% -8%, rgba(255, 251, 238, .9), transparent 60%),
    radial-gradient(900px 700px at -10% 20%, rgba(232, 237, 224, .5), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  z-index: 0;
  background-image: radial-gradient(rgba(89, 79, 60, .18) .55px, transparent .55px);
  background-size: 5px 5px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .45), transparent 70%);
}

h1, h2, h3, h4, p {
  margin: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

::selection {
  background: var(--green-soft);
  color: var(--green-deep);
}

:focus-visible {
  outline: 2px solid var(--green-mid);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--green);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  transition: top .2s;
}

.skip-link:focus {
  top: 16px;
}

.app-root {
  position: relative;
  z-index: 1;
}

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
}

.boot-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 19px;
  background: var(--green);
  color: #fbf7ec;
  font-family: var(--serif);
  font-size: 26px;
  box-shadow: var(--shadow);
  animation: breathe 2.4s ease-in-out infinite;
}

.boot-screen p {
  font-size: 13px;
  letter-spacing: .08em;
}

.loading-page {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.loading-line {
  width: 220px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-3), var(--surface), var(--surface-3));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.loading-line.short {
  width: 130px;
}

/* ============ typography & atoms ============ */
.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--green);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 4px;
}

.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.22;
  margin: 5px 0 8px;
}

.page-head .eyebrow {
  color: var(--muted);
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: pageIn .45s var(--ease) both;
}

.muted-copy {
  color: var(--muted);
  font-size: 13px;
}

.danger-text {
  color: var(--rose) !important;
}

.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.6;
  padding: 3px 4px 0;
}

.disclaimer .icon {
  flex: none;
  margin-top: 1px;
}

/* ============ buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background .18s, color .18s, border-color .18s, transform .18s, box-shadow .18s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--green);
  color: #fdfaf2;
  box-shadow: 0 10px 24px -14px rgba(23, 63, 48, .7);
}

.btn-primary:hover {
  background: var(--green-deep);
  box-shadow: 0 14px 30px -14px rgba(23, 63, 48, .6);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.btn-soft {
  background: var(--green-soft);
  color: var(--green-deep);
}

.btn-soft:hover {
  background: #d6e6da;
}

.btn-danger {
  background: var(--rose);
  color: #fff;
}

.btn-danger:hover {
  background: #8f4036;
}

.btn-danger-ghost {
  border-color: #e7c9c3;
  color: var(--rose);
  background: transparent;
}

.btn-danger-ghost:hover {
  background: var(--rose-soft);
}

.btn-lg {
  min-height: 50px;
  padding: 13px 22px;
  font-size: 14px;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 13px;
  font-size: 12px;
}

.btn-xs {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 11px;
}

.btn-block {
  width: 100%;
}

.btn-wechat {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
  justify-content: center;
}

.btn-wechat small {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-3);
}

.btn:disabled {
  opacity: .55;
  box-shadow: none;
}

.btn.is-loading,
.btn[disabled].is-loading {
  opacity: .8;
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  transition: background .18s, border-color .18s, color .18s;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.icon-btn.small {
  width: 31px;
  height: 31px;
}

.icon-btn.tiny {
  width: 25px;
  height: 25px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.icon-btn.danger:hover {
  color: var(--rose);
  background: var(--rose-soft);
  border-color: #ecd0ca;
}

.icon-btn:disabled {
  opacity: .35;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.text-btn:hover {
  color: var(--green-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--green);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tiny-text {
  font-size: 10.5px;
  font-weight: 500;
}

.btn-code {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--green);
  min-height: 36px;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 10px;
  flex: none;
}

.btn-code:hover {
  border-color: var(--green-mid);
  background: var(--green-pale);
}

.btn-code:disabled {
  color: var(--muted-2);
}

/* ============ badges, chips, tags ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green-deep);
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.badge-neutral {
  background: var(--surface-3);
  color: var(--muted);
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  transition: all .16s;
}

.chip:hover {
  border-color: var(--green-mid);
}

.chip.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fffdf7;
}

.chip-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* ============ avatars & brand ============ */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--avatar, var(--green));
  color: #fffdf6;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 253, 246, .3);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.avatar-md {
  width: 42px;
  height: 42px;
  font-size: 16px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: inline-flex;
  flex: none;
}

.mark {
  display: block;
  border-radius: 15px;
  box-shadow: 0 8px 18px -12px rgba(23, 63, 48, .5);
}

.brand-word {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.15;
  color: var(--green-deep);
}

.brand-word small {
  display: block;
  font-family: var(--sans);
  font-size: 8.5px;
  letter-spacing: .12em;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

/* ============ cards ============ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

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

.section-head h2 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .01em;
}

.section-head p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  max-width: 520px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 46px 24px;
  gap: 7px;
}

.empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green);
  margin-bottom: 4px;
}

.empty-state h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.empty-state p {
  color: var(--muted);
  font-size: 12.5px;
  max-width: 320px;
}

.empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

/* ============ auth ============ */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  background: var(--bg);
}

.auth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 44px clamp(36px, 5vw, 78px) 34px;
  color: #f5efdf;
  background:
    radial-gradient(680px 520px at 78% 18%, rgba(112, 157, 124, .35), transparent 65%),
    radial-gradient(500px 420px at 10% 95%, rgba(196, 146, 82, .18), transparent 70%),
    linear-gradient(155deg, #1d4d3a 0%, #173f30 58%, #14382b 100%);
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 45%, #000, transparent 78%);
}

.auth-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand .mark {
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}

.auth-brand .brand-word {
  color: #f8f2e2;
  font-size: 25px;
}

.auth-brand .brand-word small {
  color: rgba(246, 240, 224, .58);
}

.hero-copy {
  position: relative;
  z-index: 2;
  margin-top: clamp(64px, 12vh, 132px);
  max-width: 560px;
}

.hero-copy .eyebrow {
  color: #d9b986;
  margin-bottom: 18px;
}

.hero-copy h1 {
  font-family: var(--serif);
  font-size: clamp(46px, 5.6vw, 76px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.hero-copy h1 em {
  font-style: normal;
  color: #e6c796;
}

.hero-copy .lede {
  margin-top: 24px;
  max-width: 390px;
  color: rgba(246, 240, 225, .72);
  font-size: 14px;
  line-height: 2;
}

.plate-art {
  position: absolute;
  right: clamp(-58px, -3vw, -20px);
  bottom: clamp(22px, 4vh, 58px);
  width: clamp(300px, 32vw, 430px);
  z-index: 1;
  opacity: .92;
  pointer-events: none;
}

.plate-art .plate-svg {
  width: 100%;
  height: auto;
  filter: saturate(.86);
}

.art-card {
  position: absolute;
  top: 58%;
  left: 2%;
  width: 148px;
  padding: 15px 17px 13px;
  border-radius: 15px;
  background: rgba(255, 252, 243, .95);
  color: var(--ink);
  box-shadow: 0 22px 50px -18px rgba(0, 0, 0, .35);
  transform: rotate(-4deg);
  display: flex;
  flex-direction: column;
}

.art-card-top {
  font-size: 9.5px;
  letter-spacing: .05em;
  color: var(--muted);
}

.art-card strong {
  font-family: var(--num);
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -.03em;
  margin-top: 4px;
}

.art-card-unit {
  font-size: 10px;
  color: var(--muted);
}

.art-note {
  position: absolute;
  right: 7%;
  bottom: 1%;
  color: rgba(246, 240, 225, .55);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.75;
  letter-spacing: .08em;
  text-align: right;
}

.auth-foot {
  position: relative;
  z-index: 2;
  margin-top: auto;
  color: rgba(246, 240, 225, .42);
  font-size: 10px;
  letter-spacing: .14em;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 30px;
  background:
    radial-gradient(620px 460px at 100% 0%, #fbf7eb, transparent 60%),
    var(--bg);
}

.auth-card {
  width: min(430px, 100%);
}

.auth-card-head .eyebrow {
  color: var(--amber);
  margin-bottom: 8px;
}

.auth-card-head h2 {
  font-family: var(--serif);
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.auth-card-head p:last-child {
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
}

.auth-form {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.phone-input,
.code-input {
  display: flex;
  align-items: center;
}

.phone-input,
.code-input {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .18s, box-shadow .18s;
}

.phone-input:focus-within,
.code-input:focus-within {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(35, 93, 70, .08);
}

.phone-prefix {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  border-right: 1px solid var(--line);
  line-height: 22px;
}

.phone-input input,
.code-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 13px 14px;
  font-size: 14px;
  outline: 0;
}

.code-input input {
  letter-spacing: .18em;
}

.code-input .btn-code {
  margin-right: 5px;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
  cursor: pointer;
}

.consent-check input,
.check-row input {
  appearance: none;
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.consent-check input::after,
.check-row input::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg) translateY(-1px) scale(0);
  transition: transform .12s;
}

.consent-check input:checked,
.check-row input:checked {
  background: var(--green);
  border-color: var(--green);
}

.consent-check input:checked::after,
.check-row input:checked::after {
  transform: rotate(-45deg) translateY(-1px) scale(1);
}

.demo-box {
  margin-top: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 253, 248, .6);
  padding: 14px 15px;
}

.demo-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-soft);
}

.demo-code {
  color: var(--amber-deep);
  background: var(--amber-soft);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
}

.demo-box p {
  color: var(--muted);
  font-size: 11px;
  margin: 5px 0 10px;
}

.demo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 9px 11px;
  text-align: left;
  transition: all .16s;
}

.demo-btn:hover {
  border-color: var(--green-mid);
  background: var(--green-pale);
}

.demo-btn strong {
  font-size: 12px;
  color: var(--green-deep);
}

.demo-btn span {
  font-size: 9.5px;
  color: var(--muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted-2);
  font-size: 10px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.auth-legal {
  margin-top: 15px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.7;
  text-align: center;
}

.auth-copyright {
  color: var(--muted-2);
  font-size: 10px;
  margin-top: 34px;
  letter-spacing: .08em;
}

/* ============ shell & nav ============ */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 242px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 22px;
  border-right: 1px solid var(--line);
  background: rgba(249, 246, 237, .82);
  backdrop-filter: blur(16px);
}

.sidebar .brand {
  padding: 0 7px 30px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background .16s, color .16s;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--surface);
  color: var(--green-deep);
  box-shadow: var(--shadow-soft);
  font-weight: 600;
}

.nav-item.is-active .icon {
  color: var(--green);
}

.side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-quote {
  font-family: var(--serif);
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.8;
  letter-spacing: .04em;
  padding: 0 8px;
  border-left: 1px solid var(--line-strong);
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: background .16s, border-color .16s;
}

.account-chip:hover,
.account-chip.is-active {
  background: var(--surface);
  border-color: var(--line);
}

.account-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.account-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.account-copy small {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: .03em;
}

.account-chip > .icon {
  color: var(--muted-2);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  margin-left: 242px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 70px;
  padding: 0 clamp(24px, 4vw, 58px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(to bottom, rgba(244, 240, 230, .94), rgba(244, 240, 230, .72) 70%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-spacer {
  flex: 1;
}

.topbar-mobile-brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.member-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .8);
  box-shadow: var(--shadow-soft);
  transition: border-color .16s, background .16s;
}

.member-switch:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.member-switch-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 52px;
}

.member-switch-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.member-switch-copy small {
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: .04em;
}

.member-switch > .icon {
  color: var(--muted-2);
}

.btn-top-add {
  margin-left: 2px;
}

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px clamp(24px, 4vw, 58px) 80px;
}

.tabbar {
  display: none;
}

/* ============ home ============ */
.home-top {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 18px;
}

.hero-card {
  min-height: 250px;
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 26px;
  overflow: hidden;
  background:
    radial-gradient(480px 260px at 100% 0%, rgba(224, 234, 220, .85), transparent 70%),
    var(--surface);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -80px;
  top: -90px;
  border: 1px solid rgba(35, 93, 70, .12);
  border-radius: 50%;
}

.hero-copy-block {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-mid);
  box-shadow: 0 0 0 4px rgba(35, 93, 70, .1);
}

.hero-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  font-family: var(--num);
  font-size: clamp(58px, 6.4vw, 82px);
  line-height: 1;
  letter-spacing: -.055em;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

.hero-value span {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--muted);
  transform: translateY(-8px);
}

.hero-meta {
  margin-top: 11px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.hero-links {
  margin-top: auto;
  padding-top: 20px;
}

.hero-chart {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.sparkline {
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-chart-foot {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: .04em;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.mini-empty {
  color: var(--muted-2);
  font-size: 12px;
  padding: 40px 0;
  text-align: center;
}

.hero-empty {
  grid-template-columns: 1fr auto;
  align-items: center;
  background:
    radial-gradient(420px 260px at 90% 50%, rgba(246, 231, 211, .7), transparent 70%),
    var(--surface);
}

.hero-empty h2 {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  margin: 14px 0 6px;
}

.hero-empty p {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 18px;
}

.hero-empty-mark {
  color: var(--green);
  opacity: .1;
  padding-right: 14px;
}

.today-summary {
  display: flex;
  flex-direction: column;
  padding: 22px 23px;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
}

.summary-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 18px 0 16px;
}

.summary-stats div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.summary-stats strong {
  font-family: var(--num);
  font-size: 36px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -.03em;
  color: var(--green-deep);
}

.summary-stats span {
  color: var(--muted);
  font-size: 10.5px;
}

.carb-block {
  border-radius: 13px;
  background: var(--amber-pale);
  border: 1px solid #efdfc9;
  padding: 12px 14px;
  margin-top: auto;
}

.med-summary-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  margin-bottom: 9px;
  border: 1px solid #d6e3da;
  border-radius: 9px;
  background: var(--green-pale);
  color: var(--green-deep);
  font-size: 10.5px;
}

.med-summary-link > span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.med-summary-link strong {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
}

.med-summary-link > .icon {
  color: var(--green);
}

.carb-label {
  color: var(--amber-deep);
  font-size: 10px;
  letter-spacing: .1em;
}

.carb-block div {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 3px 0;
}

.carb-block strong {
  font-family: var(--num);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.03em;
}

.carb-block div span {
  color: var(--muted);
  font-size: 11px;
}

.carb-block small {
  color: var(--muted);
  font-size: 9.5px;
}

.summary-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--green);
  font-size: 11.5px;
  font-weight: 600;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 18px;
  align-items: start;
}

.home-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.feed-card {
  padding: 22px 24px 10px;
}

.feed-list {
  display: flex;
  flex-direction: column;
}

.feed-item {
  display: grid;
  grid-template-columns: 34px 46px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.feed-item:first-child {
  border-top: 0;
}

.feed-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.feed-glucose {
  background: var(--green-pale);
  color: var(--green);
}

.feed-meal {
  background: var(--amber-pale);
  color: var(--amber-deep);
}

.feed-medication {
  background: #e9ecf3;
  color: #5f688f;
}

.feed-time {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.feed-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.feed-body strong {
  font-size: 12px;
  font-weight: 600;
}

.feed-body span {
  color: var(--muted);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-value {
  font-family: var(--num);
  font-size: 19px;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

.feed-value small {
  font-family: var(--sans);
  font-size: 8.5px;
  color: var(--muted-2);
}

.feed-value-meal {
  color: var(--amber-deep);
}

.feed-value-med {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  color: #5f688f;
  white-space: nowrap;
}

.reminder-card {
  padding: 20px 21px;
}

.reminder-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .08em;
  font-weight: 600;
}

.next-reminder {
  margin: 13px 0 10px;
  display: flex;
  flex-direction: column;
}

.next-reminder strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--green-deep);
}

.next-reminder span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.plate-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px 15px 12px;
  overflow: hidden;
}

.plate-mini {
  width: 108px;
  flex: none;
}

.plate-mini .plate-svg {
  width: 100%;
  height: auto;
}

.plate-label {
  font-family: var(--num);
  font-size: 26px;
  fill: #fffdf7;
}

.plate-sub {
  font-family: var(--sans);
  font-size: 11px;
  fill: rgba(255, 253, 247, .86);
  letter-spacing: .08em;
}

.plate-copy h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin: 4px 0 5px;
}

.plate-copy p:not(.eyebrow) {
  color: var(--muted);
  font-size: 10.5px;
  margin-bottom: 4px;
}

.nudge-card {
  border-color: #e7d6bd;
  background:
    radial-gradient(360px 180px at 100% 0%, rgba(246, 231, 211, .8), transparent 70%),
    var(--surface);
}

.nudge-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--amber-soft);
  color: var(--amber-deep);
  margin-bottom: 12px;
}

.nudge-card h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin: 5px 0 6px;
}

.nudge-card p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 13px;
}

.readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #cfded3;
  border-radius: 12px;
  background: var(--green-pale);
  color: var(--green-deep);
  font-size: 11.5px;
  margin-bottom: 2px;
}

.readonly-banner span {
  flex: 1;
}

.readonly-banner a {
  color: var(--green);
  font-weight: 600;
  white-space: nowrap;
}

/* ============ date nav, lists ============ */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}

.date-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  cursor: pointer;
}

.date-pill .icon {
  color: var(--muted-2);
}

.date-nav .text-btn {
  margin-left: 4px;
  font-size: 11px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(250px, .72fr);
  gap: 18px;
  align-items: start;
}

.content-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list-card {
  padding: 8px 22px;
}

.record-list {
  display: flex;
  flex-direction: column;
}

.record-row {
  display: grid;
  grid-template-columns: 72px 108px 1fr auto;
  gap: 14px;
  align-items: flex-start;
  padding: 19px 0;
  border-top: 1px solid var(--line);
}

.record-row:first-child {
  border-top: 0;
}

.record-time {
  display: flex;
  flex-direction: column;
}

.record-time strong {
  font-family: var(--num);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -.02em;
}

.record-time span {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}

.record-value {
  font-family: var(--num);
  font-size: 31px;
  line-height: 1;
  color: var(--green-deep);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.record-value span {
  font-family: var(--sans);
  color: var(--muted-2);
  font-size: 8.5px;
  margin-left: 4px;
  letter-spacing: 0;
}

.record-extra p {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.record-extra .muted-copy {
  color: var(--muted-2);
}

.photo-thumb {
  display: block;
  width: 92px;
  height: 68px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
  background: var(--surface-2);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-actions {
  display: flex;
  gap: 2px;
  align-items: center;
}

.note-card {
  padding: 20px 21px;
}

.note-card .note-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--green);
  margin-bottom: 11px;
}

.note-card h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.note-card p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.note-card.subtle {
  background: var(--surface-2);
}

/* ============ meals ============ */
.carb-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 28px;
  background:
    radial-gradient(460px 260px at 90% 20%, rgba(246, 231, 211, .85), transparent 70%),
    var(--surface);
}

.carb-hero-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--num);
  font-size: 55px;
  line-height: 1;
  letter-spacing: -.045em;
  color: var(--amber-deep);
  margin: 7px 0 8px;
}

.carb-hero-value span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.carb-hero p:not(.eyebrow) {
  color: var(--muted);
  font-size: 10.5px;
  max-width: 460px;
}

.carb-hero-meta {
  display: flex;
  gap: 24px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.carb-hero-meta div {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.carb-hero-meta strong {
  font-family: var(--num);
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.carb-hero-meta span {
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.meal-sections {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.meal-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 0 3px;
}

.meal-section-head h2 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.meal-section-head span {
  color: var(--muted);
  font-size: 10px;
}

.meal-card {
  padding: 18px 20px;
}

.meal-card + .meal-card {
  margin-top: 10px;
}

.meal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.meal-card-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.meal-time {
  font-family: var(--num);
  font-size: 18px;
  color: var(--ink-soft);
}

.meal-total {
  color: var(--amber-deep);
  background: var(--amber-pale);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
}

.meal-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.meal-items li {
  display: grid;
  grid-template-columns: minmax(96px, 1.2fr) 70px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 12px;
  border-top: 1px dashed rgba(226, 219, 204, .7);
}

.meal-items li:first-child {
  border-top: 0;
}

.food-name {
  color: var(--ink-soft);
}

.food-amount {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.food-carbs {
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.meal-note {
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.7;
}

.add-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: all .16s;
}

.add-row:hover {
  color: var(--green);
  border-color: var(--green-mid);
  background: var(--green-pale);
}

/* ============ timeline ============ */
.timeline-card {
  padding: 24px 24px 12px;
}

.timeline {
  position: relative;
}

.timeline-row {
  display: grid;
  grid-template-columns: 54px 22px minmax(0, 1fr);
  gap: 6px;
  position: relative;
}

.timeline-time {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
}

.timeline-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.timeline-row:last-child .timeline-rail::before {
  bottom: calc(100% - 14px);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 8px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px currentColor;
}

.dot-green {
  background: var(--green);
  color: var(--green);
}

.dot-amber {
  background: var(--amber);
  color: var(--amber);
}

.dot-med {
  background: #6a7299;
  color: #6a7299;
}

.med-timeline-copy {
  display: flex;
  flex-direction: column;
  margin-top: 3px;
}

.med-timeline-copy strong {
  font-size: 12.5px;
  font-weight: 600;
}

.med-timeline-copy span {
  color: var(--muted);
  font-size: 10px;
  margin-top: 1px;
}

.timeline-entry {
  padding: 0 0 25px 10px;
}

.timeline-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.entry-kicker {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
}

.entry-value {
  font-family: var(--num);
  font-size: 26px;
  font-weight: 400;
  color: var(--green-deep);
  letter-spacing: -.02em;
  white-space: nowrap;
}

.entry-value small {
  font-family: var(--sans);
  font-size: 8.5px;
  color: var(--muted-2);
}

.entry-value-meal {
  font-size: 21px;
  color: var(--amber-deep);
}

.meal-entry .meal-items {
  margin-top: 8px;
}

.entry-note {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.75;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.day-note-card {
  background:
    radial-gradient(320px 180px at 100% 0%, rgba(246, 231, 211, .55), transparent 70%),
    var(--surface);
}

.day-note-card h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin: 4px 0 9px;
}

.day-note-text {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.day-note-card .btn {
  margin-top: 10px;
}

/* ============ trends ============ */
.trend-controls {
  display: flex;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  gap: 2px;
}

.segmented button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 7px 15px;
  font-size: 12px;
  font-weight: 500;
  transition: all .16s;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--green-deep);
  box-shadow: 0 2px 8px rgba(37, 48, 40, .08);
  font-weight: 600;
}

.segmented.small {
  padding: 2px;
}

.segmented.small button {
  padding: 5px 11px;
  font-size: 11px;
}

.chart-card {
  padding: 24px 26px 16px;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.chart-head h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  margin-top: 3px;
}

.chart-note {
  color: var(--muted-2);
  font-size: 9.5px;
}

.chart-wrap {
  position: relative;
  padding-top: 6px;
}

.chart-unit {
  position: absolute;
  top: 10px;
  left: 48px;
  font-size: 8.5px;
  letter-spacing: .08em;
  color: var(--muted-2);
}

.line-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-axis {
  fill: var(--muted-2);
  font-family: var(--sans);
  font-size: 9.5px;
}

.chart-point circle {
  cursor: pointer;
  transition: r .15s;
}

.chart-point:hover circle {
  r: 6;
}

.chart-empty {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  border-radius: 12px;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 53px, rgba(226, 219, 204, .6) 54px),
    var(--surface-2);
}

.chart-empty-line {
  width: 46px;
  height: 2px;
  background: var(--green-soft);
  margin-bottom: 8px;
}

.chart-empty p {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink-soft);
}

.chart-empty span {
  font-size: 11px;
  color: var(--muted-2);
}

.trend-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.trend-date-row div {
  display: flex;
  gap: 14px;
}

.trend-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.trend-stat {
  padding: 17px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.trend-stat > span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
}

.trend-stat strong {
  font-family: var(--num);
  font-size: 33px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--green-deep);
  letter-spacing: -.03em;
}

.trend-stat small {
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.5;
}

.trend-note {
  padding: 20px 24px;
  background: var(--green-pale);
  border-color: #d3e1d7;
}

.trend-note p:not(.eyebrow) {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink-soft);
  margin: 5px 0 7px;
}

.trend-note small {
  color: var(--muted);
  font-size: 10px;
}

.trend-list {
  padding: 20px 24px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(226, 219, 204, .65);
}

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

th.num,
td.num {
  text-align: right;
}

td.num {
  font-family: var(--num);
  font-size: 15px;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

td.num small {
  font-family: var(--sans);
  font-size: 8px;
  color: var(--muted-2);
}

/* ============ family ============ */
.member-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.member-card {
  padding: 19px 20px 15px;
  transition: border-color .18s, transform .18s;
}

.member-card.is-active {
  border-color: #bcd3c4;
  background:
    radial-gradient(300px 160px at 100% 0%, rgba(226, 236, 229, .9), transparent 70%),
    var(--surface);
}

.member-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-card-top > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.member-card-top h2 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
}

.member-card-top p {
  color: var(--muted);
  font-size: 10px;
  margin-top: 1px;
}

.member-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.member-stats div {
  display: flex;
  flex-direction: column;
}

.member-stats div:last-child {
  align-items: flex-end;
  text-align: right;
}

.member-stats strong {
  font-family: var(--num);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--green-deep);
}

.member-stats span {
  color: var(--muted);
  font-size: 9px;
}

.member-stats .small-strong {
  font-family: var(--sans);
  font-size: 10px;
  margin-top: 5px;
  color: var(--ink-soft);
}

.member-large-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--amber-deep);
  background: var(--amber-pale);
  font-size: 9px;
  padding: 4px 7px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.member-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.add-member-card {
  grid-column: 1 / -1;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .4);
  color: var(--muted);
  padding: 20px;
  transition: all .18s;
}

.add-member-card:hover {
  border-color: var(--green-mid);
  background: var(--green-pale);
  color: var(--green);
}

.add-member-card > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 5px;
}

.add-member-card strong {
  font-size: 12px;
  color: var(--ink-soft);
}

.add-member-card small {
  font-size: 9.5px;
  color: var(--muted-2);
}

.family-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  align-items: start;
}

.family-card {
  padding: 22px 24px;
}

.share-intro {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 13px;
}

.share-icon {
  color: var(--green);
  flex: none;
}

.share-intro p {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.invite-list {
  display: flex;
  flex-direction: column;
}

.invite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.invite-row:first-child {
  border-top: 0;
}

.invite-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.invite-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.invite-copy small {
  color: var(--muted);
  font-size: 9.5px;
}

.active-invites {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.active-invite {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--amber-pale);
  font-size: 9.5px;
  color: var(--muted);
}

.active-invite code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--amber-deep);
  letter-spacing: .12em;
  font-weight: 600;
}

.pending-block,
.followers-block {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.pending-block h3,
.followers-block h3 {
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.follow-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
}

.follow-row > div:nth-child(2) {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.follow-row strong {
  font-size: 11.5px;
  font-weight: 600;
}

.follow-row small {
  color: var(--muted);
  font-size: 9px;
}

.anon-avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
}

.family-empty {
  margin-top: 10px;
}

.follow-code-form {
  display: flex;
  gap: 7px;
  margin-bottom: 6px;
}

.follow-code-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.privacy-note {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.privacy-note p {
  font-size: 9.5px;
  line-height: 1.7;
}

.privacy-note .icon {
  flex: none;
  color: var(--muted-2);
}

.family-privacy {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(226, 236, 229, .75), transparent 70%),
    var(--surface);
  padding: 22px 26px;
}

.family-privacy > .icon {
  color: var(--green);
  flex: none;
  margin-top: 2px;
}

.family-privacy h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 5px;
}

.family-privacy p {
  color: var(--muted);
  font-size: 11.5px;
  max-width: 800px;
}

/* ============ settings ============ */
.settings-page .page-head + .settings-context {
  margin-top: -8px;
}

.settings-context {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid #d6e3da;
  border-radius: 10px;
  background: var(--green-pale);
  color: var(--green-deep);
  font-size: 10.5px;
  line-height: 1.6;
}

.settings-context .icon {
  flex: none;
  margin-top: 1px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.settings-card {
  padding: 22px 24px;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 13px;
}

.profile-copy {
  flex: 1;
  min-width: 0;
}

.profile-copy h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
}

.profile-copy p {
  color: var(--muted);
  font-size: 10.5px;
  margin: 2px 0;
}

.profile-copy small {
  color: var(--muted-2);
  font-size: 9.5px;
}

.settings-line {
  height: 1px;
  background: var(--line);
  margin: 15px 0 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  font-size: 10.5px;
}

.info-row span {
  color: var(--muted);
}

.info-row strong {
  font-weight: 500;
  text-align: right;
}

.settings-help {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
  margin-bottom: 10px;
}

.reminder-list {
  display: flex;
  flex-direction: column;
}

.reminder-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.reminder-row:first-child {
  border-top: 0;
}

.reminder-row.is-off {
  opacity: .5;
}

.reminder-type-icon {
  width: 31px;
  height: 31px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--green-pale);
  color: var(--green);
}

.reminder-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.reminder-main strong {
  font-size: 11.5px;
  font-weight: 600;
}

.reminder-main small {
  color: var(--muted);
  font-size: 9px;
}

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .16s;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
  transition: transform .16s;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(14px);
}

.notification-box {
  margin-top: 13px;
  padding: 10px 11px;
  border-radius: 9px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notification-box > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
}

.notification-box small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.notification-box .btn {
  align-self: flex-start;
  margin-top: 4px;
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 11px 0;
}

.privacy-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.privacy-list > div {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.privacy-list .icon {
  color: var(--green);
  flex: none;
  margin-top: 1px;
}

.privacy-list p {
  display: flex;
  flex-direction: column;
}

.privacy-list strong {
  font-size: 11px;
  font-weight: 600;
}

.privacy-list span {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
}

.about-card {
  padding: 25px 28px;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(226, 236, 229, .6), transparent 70%),
    var(--surface-2);
}

.about-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}

.about-brand strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: .08em;
}

.about-brand span {
  color: var(--muted-2);
  font-size: 9.5px;
}

.about-card p {
  color: var(--muted);
  font-size: 11px;
  max-width: 760px;
  line-height: 1.8;
}

.about-card .about-small {
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--muted-2);
}

.about-actions {
  display: flex;
  gap: 18px;
  margin-top: 13px;
}

/* ============ medications ============ */
.med-home-card {
  padding: 18px 20px;
}

.med-home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.med-home-head .text-btn {
  font-size: 10.5px;
}

.med-home-count {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 4px 0 9px;
}

.med-home-count strong {
  font-family: var(--num);
  font-size: 36px;
  line-height: 1;
  font-weight: 400;
  color: var(--green-deep);
  letter-spacing: -.03em;
}

.med-home-count span {
  font-size: 10.5px;
  color: var(--muted);
}

.med-home-count small {
  margin-left: auto;
  font-size: 9px;
  color: var(--muted-2);
}

.med-home-list {
  display: flex;
  flex-direction: column;
}

.med-home-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.med-home-row:first-child {
  border-top: 0;
}

.med-home-time {
  font-family: var(--num);
  font-size: 15px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.med-home-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.med-home-copy strong {
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.med-home-copy small {
  font-size: 9px;
  color: var(--muted);
}

.med-home-empty {
  margin-bottom: 10px;
}

.med-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.med-home-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.med-home-links .text-btn {
  font-size: 10.5px;
}

.med-home-link {
  margin-top: 8px;
}

.med-more {
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 9px;
}

.med-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.med-status-taken {
  background: var(--green-soft);
  color: var(--green-deep);
}

.med-status-skipped {
  background: var(--surface-3);
  color: var(--muted);
}

.med-status-pending {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.med-page {
  gap: 20px;
}

.med-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 26px;
  background:
    radial-gradient(420px 220px at 92% 20%, rgba(226, 236, 229, .85), transparent 70%),
    var(--surface);
}

.med-overview-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--num);
  font-size: 54px;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--green-deep);
  margin: 5px 0 6px;
}

.med-overview-value span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.med-overview-main > p:last-child {
  color: var(--muted);
  font-size: 10.5px;
}

.med-overview-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 410px;
  padding: 11px 13px;
  border: 1px solid #d6e3da;
  border-radius: 10px;
  background: rgba(255, 253, 248, .65);
  color: var(--ink-soft);
}

.med-overview-note .icon {
  color: var(--green);
  flex: none;
  margin-top: 1px;
}

.med-overview-note p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.med-today-card {
  padding: 22px 24px;
}

.med-today-date {
  color: var(--muted);
  font-size: 10.5px;
}

.med-slot-list {
  display: flex;
  flex-direction: column;
}

.med-slot {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.med-slot:first-child {
  border-top: 0;
}

.med-slot-time {
  font-family: var(--num);
  font-size: 22px;
  letter-spacing: -.02em;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

.med-slot-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.med-slot-info strong {
  font-size: 12.5px;
  font-weight: 600;
}

.med-slot-info span {
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}

.med-slot-note {
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.5;
}

.med-slot-state {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.med-slot-taken .med-slot-time,
.med-slot-skipped .med-slot-time {
  color: var(--muted-2);
}

.med-no-plan {
  padding: 10px 0 2px;
}

.med-direct-today {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.med-direct-head {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #5f688f;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.med-direct-head span {
  margin-left: auto;
  color: var(--muted-2);
  font-weight: 400;
}

.med-direct-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.med-direct-row:first-of-type {
  border-top: 0;
}

.med-direct-row .med-slot-state {
  gap: 2px;
}

.med-plan-section {
  padding: 22px 24px;
}

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

.med-plan-card {
  padding: 17px 18px 13px;
  background: var(--surface-2);
}

.med-plan-card.is-inactive {
  opacity: .65;
}

.med-plan-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.med-plan-icon {
  width: 35px;
  height: 35px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
}

.med-plan-copy {
  flex: 1;
  min-width: 0;
}

.med-plan-copy h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.med-plan-copy p {
  color: var(--muted);
  font-size: 9.5px;
  margin-top: 1px;
}

.med-plan-times {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 13px 0 6px;
}

.med-plan-times span {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--green-deep);
  font-family: var(--num);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.med-plan-meta {
  color: var(--muted);
  font-size: 9.5px;
}

.med-plan-instructions {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 9.5px;
}

.med-plan-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.med-history-card {
  padding: 22px 24px;
}

.med-history-list {
  display: flex;
  flex-direction: column;
}

.med-history-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.med-history-row:first-child {
  border-top: 0;
}

.med-history-when {
  display: flex;
  flex-direction: column;
}

.med-history-when strong {
  font-size: 11px;
  font-weight: 500;
}

.med-history-when span {
  font-family: var(--num);
  font-size: 16px;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

.med-history-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.med-history-copy strong {
  font-size: 11.5px;
  font-weight: 600;
}

.med-history-copy small {
  color: var(--muted);
  font-size: 9px;
}

.med-history-note {
  margin-top: 3px;
  color: var(--muted-2) !important;
}

.med-time-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  align-items: center;
  margin-bottom: 8px;
}

.med-library-block {
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #d6e3da;
  border-radius: 11px;
  background: var(--green-pale);
}

.med-library-block.is-empty {
  background: var(--surface-2);
  border-color: var(--line);
}

.med-library-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.med-library-head span {
  color: var(--green-deep);
  font-size: 11px;
  font-weight: 600;
}

.med-library-head small {
  color: var(--muted);
  font-size: 8.5px;
  text-align: right;
}

.med-library-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 138px;
  overflow-y: auto;
}

.med-library-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 118px;
  max-width: 210px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  text-align: left;
  transition: border-color .14s, background .14s;
}

.med-library-item:hover {
  border-color: var(--green-mid);
}

.med-library-item.is-selected {
  border-color: var(--green);
  background: var(--green-soft);
}

.med-library-item strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
}

.med-library-item span {
  color: var(--muted);
  font-size: 8.5px;
}

.med-library-hint {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
  margin-top: 7px;
}

.med-library-section {
  padding: 22px 24px;
}

.med-library-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.med-library-manage-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.med-library-manage-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.med-library-manage-copy h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.med-library-manage-copy p {
  color: var(--muted);
  font-size: 9.5px;
  margin-top: 1px;
}

.med-library-manage-copy small {
  color: var(--muted-2);
  font-size: 9px;
  margin-top: 3px;
  line-height: 1.5;
}

.med-library-manage-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.med-time-empty {
  color: var(--muted-2);
  font-size: 10px;
}

.med-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px 5px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-family: var(--num);
  font-size: 14px;
}

.med-time-chip button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 248, .55);
  color: var(--green);
}

.med-time-add {
  display: flex;
  gap: 7px;
  align-items: center;
}

.med-time-add input {
  max-width: 150px;
}

.compact-check {
  margin-top: 0;
  padding: 10px;
}

.med-check-summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--green-pale);
  border: 1px solid #d6e3da;
  margin-bottom: 15px;
}

.med-check-icon {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface);
  color: var(--green);
}

.med-check-summary h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
}

.med-check-summary p {
  color: var(--ink-soft);
  font-size: 11px;
  margin-top: 2px;
}

.med-check-summary small {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  margin-top: 3px;
}

@media (max-width: 1120px) {
  .med-plan-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .med-overview {
    flex-direction: column;
    align-items: flex-start;
  }

  .med-overview-note {
    max-width: none;
    width: 100%;
  }

  .med-slot {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .med-direct-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .med-direct-row .med-slot-state {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 2px;
  }

  .med-slot-state {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 2px;
  }

  .med-history-row {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .med-plan-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ elder ============ */
.shell-elder {
  min-height: 100vh;
  display: block;
  background: var(--bg);
}

.elder-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  min-height: 100vh;
}

.elder-view {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 68px);
}

.elder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.elder-view h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 7vw, 42px);
  font-weight: 600;
  margin: 28px 0 22px;
  line-height: 1.3;
}

.elder-latest {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-soft);
}

.elder-latest > span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.elder-latest strong {
  font-family: var(--num);
  font-size: 60px;
  line-height: 1.1;
  font-weight: 400;
  color: var(--green-deep);
  letter-spacing: -.04em;
}

.elder-latest strong small {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}

.elder-latest > span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.elder-latest.is-empty {
  min-height: 110px;
  justify-content: center;
}

.elder-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.elder-btn {
  min-height: 86px;
  border-radius: 18px;
  font-size: 21px;
  font-weight: 600;
  gap: 10px;
}

.elder-note {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin-top: 22px;
}

.elder-med-hint {
  color: var(--amber-deep);
  background: var(--amber-pale);
  border: 1px solid #eedcc4;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  margin-top: 14px;
}

.elder-med-section {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.elder-med-section h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.elder-med-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.elder-med-row:first-of-type {
  border-top: 0;
}

.elder-med-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.elder-med-copy strong {
  font-size: 15px;
  font-weight: 600;
}

.elder-med-copy span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.elder-med-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.elder-med-actions .btn {
  min-height: 42px;
  padding: 7px 12px;
  font-size: 12px;
}

.elder-exit {
  align-self: center;
  margin-top: auto;
  padding-top: 30px;
  color: var(--muted-2);
  font-size: 11px;
}

.elder-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.elder-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px;
  border-bottom: 1px solid var(--line);
}

.elder-row span {
  color: var(--muted);
  font-size: 14px;
}

.elder-row strong {
  font-family: var(--num);
  font-size: 27px;
  font-weight: 400;
  color: var(--green-deep);
}

.elder-row strong small {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--muted);
}

.elder-empty {
  color: var(--muted);
  font-size: 16px;
  padding: 36px 0;
}

/* ============ modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(24, 34, 28, .42);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .18s var(--ease);
}

.modal-backdrop.open {
  opacity: 1;
}

.sheet {
  width: min(540px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 22px;
  box-shadow: 0 32px 90px -20px rgba(20, 33, 25, .5);
  transform: translateY(14px) scale(.985);
  opacity: 0;
  transition: transform .24s var(--ease), opacity .2s;
  outline: none;
}

.modal-backdrop.open .sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.sheet-sm {
  width: min(468px, 100%);
}

.sheet-md {
  width: min(620px, 100%);
}

.sheet-meal {
  width: min(780px, 100%);
}

.sheet-photo {
  width: min(860px, 100%);
  background: #151b18;
  border-color: rgba(255, 255, 255, .1);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.sheet-head h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2px;
}

.sheet-head .icon-btn {
  margin-top: -2px;
}

.sheet-body {
  padding: 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex: none;
  border-radius: 0 0 22px 22px;
}

.foot-hint {
  color: var(--muted);
  font-size: 10.5px;
}

.foot-hint strong {
  color: var(--amber-deep);
  font-family: var(--num);
  font-size: 16px;
  font-weight: 400;
}

.sheet-head + .sheet-body {
  padding-top: 18px;
}

.privacy-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.privacy-block h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
}

.privacy-block p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.privacy-block.warning {
  background: var(--amber-pale);
  border: 1px solid #eedcc4;
  border-radius: 10px;
  padding: 12px 14px;
}

.confirm-message {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.9;
}

/* glucose sheet */
.glucose-sheet-body {
  padding-top: 8px;
}

.glucose-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 4px 0 8px;
}

.glucose-number {
  font-family: var(--num);
  font-size: 76px;
  line-height: 1;
  letter-spacing: -.05em;
  color: var(--green-deep);
  font-variant-numeric: tabular-nums;
}

.glucose-unit {
  color: var(--muted);
  font-size: 12px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  max-width: 350px;
  margin: 0 auto 18px;
}

.key {
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  font-family: var(--num);
  font-size: 22px;
  color: var(--ink);
  transition: background .12s, transform .12s;
}

.key:hover {
  background: var(--green-pale);
}

.key:active {
  transform: scale(.97);
}

.field-block {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.custom-tag {
  margin-top: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .04em;
}

.field > span small {
  color: var(--muted-2);
  font-size: 9px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 11px;
  font-size: 13px;
  outline: 0;
  transition: border-color .16s, box-shadow .16s;
}

.input:focus,
textarea:focus {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(35, 93, 70, .08);
}

.input-sm {
  padding: 8px 10px;
  font-size: 12px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 11px;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: 0;
  min-height: 68px;
}

.field.compact {
  margin-top: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-grid .field {
  margin-top: 0;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
}

.check-row span {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 500;
}

.check-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  margin-top: 2px;
  line-height: 1.6;
}

.photo-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 13px;
}

.photo-preview {
  width: 94px;
  height: 70px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}

.photo-preview > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted-2);
}

.photo-preview small {
  font-size: 8px;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.photo-actions label {
  cursor: pointer;
}

/* meal sheet */
.meal-sheet-body {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    radial-gradient(300px 200px at 100% 0%, rgba(246, 231, 211, .3), transparent 70%);
}

.meal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.inline-time {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10.5px;
}

.inline-time input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 6px 8px;
  font-size: 11px;
}

.food-search-block {
  margin-top: 15px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  padding: 0 12px;
  color: var(--muted-2);
}

.search-box:focus-within {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(35, 93, 70, .08);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 11px 0;
  outline: 0;
  font-size: 13px;
}

.category-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0 8px;
  scrollbar-width: none;
}

.category-row::-webkit-scrollbar {
  display: none;
}

.food-results-list {
  max-height: 245px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.food-result {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 1.2fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: background .14s;
}

.food-result:first-child {
  border-top: 0;
}

.food-result:hover {
  background: var(--green-pale);
}

.food-result-name {
  font-size: 12.5px;
  font-weight: 500;
}

.food-result-meta {
  color: var(--muted);
  font-size: 9.5px;
}

.food-result-portion {
  color: var(--muted-2);
  font-size: 9px;
  display: none;
}

.food-add-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green);
}

.food-empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.selected-block {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.selected-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.selected-head h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.selected-head > span {
  color: var(--muted);
  font-size: 10px;
}

.selected-head strong {
  color: var(--amber-deep);
  font-family: var(--num);
  font-size: 17px;
  font-weight: 400;
}

.selected-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.selected-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted-2);
  font-size: 10.5px;
  text-align: center;
}

.selected-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 8px 11px;
}

.selected-item-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.selected-item-head strong {
  font-size: 12px;
  font-weight: 600;
}

.selected-item-head span {
  color: var(--muted-2);
  font-size: 9px;
}

.selected-item-head .icon-btn {
  margin-left: auto;
}

.selected-item-fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.selected-item-fields label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.selected-item-fields label > span {
  color: var(--muted);
  font-size: 8.5px;
}

.mini-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.mini-input input {
  width: 64px;
  border: 0;
  background: transparent;
  padding: 4px 6px;
  font-size: 11px;
  outline: 0;
  font-variant-numeric: tabular-nums;
}

.mini-input em {
  font-style: normal;
  color: var(--muted-2);
  font-size: 9px;
  padding-right: 6px;
}

.mini-input input.is-overridden {
  color: var(--amber-deep);
  font-weight: 600;
}

.custom-food-toggle {
  margin-top: 8px;
}

.custom-food {
  margin-top: 6px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.custom-food-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr .7fr auto;
  gap: 7px;
  align-items: end;
}

.custom-food-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.custom-food-grid label span {
  color: var(--muted);
  font-size: 8.5px;
}

.custom-food-grid .input {
  padding: 6px 8px;
}

.source-note {
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.7;
  margin-top: 13px;
}

/* member picker */
.member-picker {
  padding-top: 12px;
}

.picker-label {
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: .12em;
  padding: 6px 4px;
}

.member-pick {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  transition: background .15s;
}

.member-pick:hover,
.member-pick.is-active {
  background: var(--green-pale);
}

.member-pick-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.member-pick-copy strong {
  font-size: 12.5px;
  font-weight: 600;
}

.member-pick-copy small {
  color: var(--muted);
  font-size: 9.5px;
}

.pick-check {
  color: var(--green);
}

.member-manage-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 11px 9px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}

/* reminder sheet */
.day-row {
  display: flex;
  gap: 5px;
}

.day-chip {
  flex: 1;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.day-chip.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 600;
}

.quick-days {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  margin-bottom: 3px;
}

.quick-days .text-btn {
  font-weight: 500;
  font-size: 10px;
  color: var(--muted);
}

/* invite */
.invite-lede {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
}

.invite-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 4px;
  padding: 15px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
}

.invite-code-box code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 30px;
  letter-spacing: .22em;
  color: var(--green-deep);
  font-weight: 600;
}

.invite-expiry {
  color: var(--muted-2);
  font-size: 9.5px;
}

.invite-steps {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.invite-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.invite-steps li span {
  width: 21px;
  height: 21px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green);
  font-size: 9px;
  font-weight: 600;
}

.readonly-explain {
  display: flex;
  gap: 9px;
  margin-top: 18px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--green-pale);
  color: var(--green-deep);
}

.readonly-explain .icon {
  flex: none;
  margin-top: 1px;
}

.readonly-explain p {
  font-size: 10px;
  line-height: 1.7;
}

/* day note / plate / photo */
.note-textarea {
  min-height: 150px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.9;
}

.plate-guide-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
}

.plate-guide-art .plate-svg {
  width: 100%;
  height: auto;
}

.plate-guide-copy {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.plate-guide-copy > div {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 3px 8px;
  align-items: baseline;
}

.plate-num {
  font-family: var(--num);
  font-size: 22px;
  color: var(--green);
  grid-row: span 2;
}

.plate-guide-copy h3 {
  font-size: 12px;
  font-weight: 600;
}

.plate-guide-copy p {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.plate-guide-body .source-note {
  grid-column: 1 / -1;
  margin-top: 0;
}

.photo-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  color: rgba(255, 255, 255, .75);
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.photo-modal-head .icon-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, .15);
  color: rgba(255, 255, 255, .8);
}

.photo-modal-body {
  padding: 14px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.photo-modal-body img {
  max-height: calc(88vh - 90px);
  width: auto;
  max-width: 100%;
  border-radius: 8px;
}

.quick-add-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-choice {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  text-align: left;
  transition: all .16s;
}

.quick-choice:hover {
  border-color: var(--green-mid);
  background: var(--green-pale);
}

.quick-choice-icon {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
}

.quick-choice-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.quick-choice-icon.amber {
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.quick-choice-icon.med {
  background: #e9ecf3;
  color: #5f688f;
}

.quick-choice > span:nth-child(2) {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.quick-choice strong {
  font-size: 13px;
  font-weight: 600;
}

.quick-choice small {
  color: var(--muted);
  font-size: 10px;
}

.quick-choice > .icon {
  color: var(--muted-2);
}

/* ============ toast ============ */
.toast-root {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(94vw, 460px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(30, 43, 36, .94);
  color: #fbf7ed;
  font-size: 11.5px;
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  backdrop-filter: blur(8px);
}

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

.toast-success {
  background: rgba(28, 78, 57, .96);
}

.toast-error {
  background: rgba(126, 53, 44, .96);
}

.toast .icon {
  flex: none;
}

.spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}

/* ============ error page ============ */
.error-page {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.error-page h1 {
  font-family: var(--serif);
  font-size: 24px;
  margin-top: 6px;
}

.error-page p {
  color: var(--muted);
  font-size: 13px;
}

.error-page .empty-actions {
  margin-top: 14px;
}

/* ============ responsive ============ */
@media (max-width: 1120px) {
  .home-top,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .content-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(230px, .6fr);
  }
}

@media (max-width: 980px) {
  .sidebar {
    display: none;
  }

  .main-wrap {
    margin-left: 0;
  }

  .topbar {
    height: 62px;
    padding: 0 18px;
    background: rgba(244, 240, 230, .86);
    border-bottom: 1px solid rgba(226, 219, 204, .6);
  }

  .topbar-mobile-brand {
    display: flex;
  }

  .main {
    padding: 16px 18px calc(98px + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-around;
    padding: 8px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 253, 248, .92);
    backdrop-filter: blur(18px);
  }

  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
    padding: 4px 3px;
    border-radius: 10px;
    color: var(--muted-2);
    font-size: 9px;
  }

  .tab-item.is-active {
    color: var(--green);
    background: var(--green-pale);
  }

  .btn-top-add span {
    display: none;
  }

  .btn-top-add {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 50%;
  }

  .toast-root {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 0;
    padding: 30px 26px 34px;
  }

  .hero-copy {
    margin-top: 46px;
  }

  .hero-copy h1 {
    font-size: clamp(38px, 9vw, 54px);
  }

  .hero-copy .lede {
    font-size: 12.5px;
    margin-top: 16px;
  }

  .plate-art {
    display: none;
  }

  .art-card,
  .art-note {
    display: none;
  }

  .auth-foot {
    margin-top: 50px;
  }

  .auth-panel {
    padding: 34px 22px 42px;
  }
}

@media (max-width: 760px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .home-side {
    grid-template-columns: 1fr;
  }

  .page-head h1 {
    font-size: 30px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .home-side {
    grid-template-columns: 1fr;
  }

  .hero-card {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 24px;
  }

  .hero-chart {
    margin-top: 8px;
  }

  .hero-value {
    font-size: 66px;
  }

  .content-grid,
  .settings-grid,
  .family-grid,
  .trend-summary {
    grid-template-columns: 1fr;
  }

  .content-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .record-row {
    grid-template-columns: 60px 1fr auto;
    gap: 10px;
  }

  .record-value {
    grid-column: 2;
    grid-row: 1;
    font-size: 28px;
  }

  .record-time {
    grid-row: 1;
  }

  .record-extra {
    grid-column: 2 / -1;
  }

  .row-actions {
    grid-column: 3;
    grid-row: 1;
  }

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

  .carb-hero-meta {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    width: 100%;
    justify-content: flex-start;
  }

  .carb-hero-meta div {
    align-items: flex-start;
  }

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

  .timeline-row {
    grid-template-columns: 42px 18px minmax(0, 1fr);
  }

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

  .plate-guide-body {
    grid-template-columns: 1fr;
  }

  .plate-guide-art {
    max-width: 220px;
    margin: 0 auto;
  }

  .custom-food-grid {
    grid-template-columns: 1fr 1fr;
  }

  .custom-food-grid .btn {
    grid-column: 1 / -1;
  }

  .sheet {
    max-height: 92vh;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .sheet,
  .sheet-sm,
  .sheet-md,
  .sheet-meal,
  .sheet-photo {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }

  .sheet-foot {
    border-radius: 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .sheet-head,
  .sheet-body,
  .sheet-foot {
    padding-left: 18px;
    padding-right: 18px;
  }

  .toast-root {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .table-wrap table {
    min-width: 460px;
  }

  .family-privacy {
    padding: 19px;
  }

  .elder-main {
    padding: 22px 20px 30px;
  }
}

@media (max-width: 520px) {
  .main {
    padding: 12px 14px calc(94px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-mobile-brand span:last-child {
    font-size: 15px;
  }

  .member-switch-copy {
    min-width: 42px;
  }

  .member-switch-copy small {
    display: none;
  }

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

  .add-member-card {
    min-height: 132px;
  }

  .content-side {
    grid-template-columns: 1fr;
  }

  .page-stack {
    gap: 16px;
  }

  .card {
    padding: 18px;
  }

  .feed-card,
  .list-card,
  .timeline-card,
  .meal-card,
  .family-card,
  .settings-card,
  .chart-card {
    padding-left: 17px;
    padding-right: 17px;
  }

  .hero-card {
    padding: 21px;
  }

  .hero-value {
    font-size: 60px;
  }

  .hero-empty h2 {
    font-size: 23px;
  }

  .hero-empty-mark {
    display: none;
  }

  .feed-item {
    grid-template-columns: 30px 40px 1fr auto;
    gap: 7px;
  }

  .feed-value {
    font-size: 17px;
  }

  .trend-date-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .trend-controls {
    justify-content: flex-start;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    padding-left: 8px;
    padding-right: 8px;
  }

  .date-nav {
    flex-wrap: wrap;
  }

  .date-nav .text-btn {
    margin-left: auto;
  }

  .elder-btn {
    min-height: 78px;
    font-size: 19px;
  }

  .glucose-number {
    font-size: 64px;
  }

  .key {
    height: 46px;
  }

  .food-result {
    grid-template-columns: 1fr auto;
  }

  .food-result-meta {
    grid-column: 1;
  }

  .food-add-icon {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .food-result-portion {
    display: block;
    grid-column: 1;
  }

  .invite-code-box code {
    font-size: 25px;
  }

  .about-actions {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ keyframes ============ */
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 8px 24px -10px rgba(23, 63, 48, .4);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 14px 34px -12px rgba(23, 63, 48, .55);
  }
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 300;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--rose);
  color: #fff;
  font-size: 13px;
}
