/* CHEEVA แอปคนไข้ — สไตล์หลัก (แยกจาก index.html) */
  /* ฟอนต์: Noto Sans Thai (ไทย + อังกฤษ ตัวเดียวทั้งแอป) — SIL OFL ดู shared/fonts/README.md */
  @font-face { font-family: "Noto Sans Thai"; src: url("../shared/fonts/NotoSansThai-var.woff") format("woff"); font-weight: 300 800; font-display: swap; }
  /* สีพื้นฐาน (ใช้ตอนพิมพ์) · สีบนจอมาจากธีม CHEEVA ด้านล่าง · ธีมมืดใช้เมื่อ <html data-theme="dark"> (ตั้งจากสคริปต์ด้านบน) */
  :root {
    color-scheme: light;
    --bg: #f6f4ee; --card: #ffffff; --field: #ffffff; --ink: #14202e; --muted: #5a6573; --line: #e4dfd3;
    --brand: #16283b; --brand-ink: #ffffff; --brand-soft: #eef1f4; --gold: #80601c; --gold-soft: #f6efdd;
    --ok: #0f766e; --ok-soft: #e3f2ef; --ok-ink: #0b4f49; --ok-line: #b7e0d9;
    --warn: #8a5200; --warn-soft: #fff4e0; --warn-ink: #6b4000; --warn-line: #f3d9a8;
    --danger: #b42318; --danger-fill: #b42318; --danger-soft: #fdecea; --danger-ink: #7a1a12; --danger-line: #f1c4bf;
    --nav: rgba(255, 255, 255, .97); --shadow: 0 1px 2px rgba(20, 32, 46, .05), 0 10px 28px rgba(20, 32, 46, .06);
    --grid: #e9e5da; --focus: #c9a85a;
    --c-weight: #0f766e; --c-sys: #c2410c; --c-dia: #2563eb; --c-pre: #0f766e; --c-post: #c2410c; --c-bed: #7c5cc4; --c-other: #6b7280; --c-line: #94a3b8;
    --radius: 18px;
    --serif: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-family: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  }
  @media screen {
    :root[data-theme="dark"] {
      color-scheme: dark;
      --bg: #0f1720; --card: #17212c; --field: #0f1720; --ink: #eef2f6; --muted: #9aa9ba; --line: #2a3848;
      --brand: #d4b26a; --brand-ink: #1a1405; --brand-soft: #1f2c3a; --gold: #d4b26a; --gold-soft: #2a2415;
      --ok: #2fb8a6; --ok-soft: #12302d; --ok-ink: #bdf0e8; --ok-line: #1f5952;
      --warn: #f0a43a; --warn-soft: #33260f; --warn-ink: #ffd89a; --warn-line: #5c4318;
      --danger: #ff8279; --danger-fill: #c9372c; --danger-soft: #3a1517; --danger-ink: #ffd7d8; --danger-line: #6b2a2d;
      --nav: rgba(15, 23, 32, .97); --shadow: none; --grid: #2a3848; --focus: #d4b26a;
      --c-weight: #2fb8a6; --c-sys: #ff8a4c; --c-dia: #6ea8ff; --c-pre: #2fb8a6; --c-post: #ff8a4c; --c-bed: #b39bf0; --c-other: #9aa9ba; --c-line: #5b6b7d;
    }
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; background: var(--bg); color: var(--ink); }
  body { font-size: 18px; line-height: 1.55; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .ic { width: 24px; height: 24px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  header.top { padding: calc(10px + env(safe-area-inset-top)) 18px 0; max-width: 640px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
  .wm { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 15px; letter-spacing: .2em; font-weight: 600; color: var(--brand); }
  .wm-mark { width: 26px; height: 26px; }
  #top-back { border: 0; background: none; color: var(--muted); padding: 8px 0 8px 12px; min-height: 44px; font-size: 15px; }
  main { max-width: 640px; margin: 0 auto; padding: 4px 14px 24px; }
  .hero { padding: 4px 4px 2px; }
  .hero h1 { font-family: var(--serif); font-weight: 600; font-size: 32px; line-height: 1.3; margin: 0; }
  .hero p { margin: 2px 0 0; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; box-shadow: var(--shadow); }
  .card h2, dialog h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.35; }
  .card h2 { margin: 0 0 10px; }
  .card h3 { font-size: 16px; margin: 14px 0 6px; }
  .muted { color: var(--muted); font-size: 14px; }
  .hidden { display: none !important; }
  .cv-motto { font-family: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .02em; }
  .cv-motto-lg { font-size: 22px; margin: 0; color: var(--brand); }
  label { display: block; font-size: 15px; margin: 10px 0 4px; color: var(--muted); }
  input, select, textarea {
    width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink);
  }
  input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
  textarea { min-height: 64px; resize: vertical; }
  /* minmax(0, …) + min-width: 0 กันช่องวันที่ดันกริดล้นจอแคบ */
  .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .row input, .row select, .row3 input, .row3 select { min-width: 0; }
  .row > *, .row3 > * { min-width: 0; }
  /* iOS Safari: ช่องวันที่/เวลามีความกว้างขั้นต่ำของตัวเอง ทำให้ล้นกรอบและทับกัน */
  input[type="date"], input[type="time"], input[type="datetime-local"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; min-height: 48px; }
  input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
  button { font: inherit; cursor: pointer; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 11px 14px; min-height: 44px; }
  button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; width: 100%; padding: 14px; margin-top: 14px; }
  .row > button.primary { margin-top: 0; }
  button.danger { color: var(--danger); border-color: var(--danger-line); }
  button.danger.primary { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
  button.small { padding: 8px 12px; font-size: 14px; }
  button.link { border: 0; background: none; color: var(--gold); padding: 10px 0; font-weight: 600; text-align: left; }
  button:disabled { opacity: .5; cursor: not-allowed; }
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .seg button { padding: 10px 4px; font-size: 15px; }
  .seg.four { grid-template-columns: repeat(4, 1fr); }
  .seg.four button { font-size: 14px; padding: 10px 2px; }
  .seg button[aria-pressed="true"], .quick button[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--ink); font-weight: 600; }
  .guide-nav { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 8px 0; }
  .steps { counter-reset: st; list-style: none; padding: 0; margin: 8px 0; }
  .steps li { counter-increment: st; position: relative; padding: 4px 0 8px 38px; }
  .steps li::before { content: counter(st); position: absolute; left: 0; top: 2px; width: 26px; height: 26px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-weight: 700; text-align: center; font-size: 14px; line-height: 26px; }
  ul.tight { padding-left: 20px; margin: 6px 0; }
  ul.tight li { margin: 3px 0; }
  .callout { border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 15px; }
  .callout.red { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger-line); }
  .callout.amber { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); }
  .callout.teal { background: var(--ok-soft); color: var(--ok-ink); border: 1px solid var(--ok-line); }
  .week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0; }
  .week .d { background: var(--bg); border-radius: 10px; padding: 6px 2px; text-align: center; font-size: 12px; color: var(--muted); }
  .week .d b { display: block; color: var(--ink); font-size: 13px; }
  .week .d .s { display: block; font-size: 13px; margin-top: 2px; }
  .week .d.ok { background: var(--ok-soft); }
  .week .d.today { outline: 2px solid var(--gold); }
  .big { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1.2; }
  .pill { display: inline-block; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
  .pill.now { background: var(--ok-soft); color: var(--ok-ink); }
  .pill.due { background: var(--warn-soft); color: var(--warn-ink); }
  .pill.future { background: var(--brand-soft); color: var(--muted); }
  .pill.risk { background: var(--brand-soft); color: var(--ink); }
  .pill.past { background: var(--brand-soft); color: var(--muted); }
  .pill.free { background: var(--gold-soft); color: var(--gold); }
  /* ไทม์ไลน์คัดกรองใช้สีประจำอวัยวะแบบตายตัว จึงวางบนแผ่นสีขาวเสมอ */
  .tl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin: 10px 0 4px; }
  .tl-wrap svg { display: block; }
  .sc-card { border-left: 5px solid var(--c); background: var(--card); border-radius: 12px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 14px; margin: 8px 0; }
  .sc-card.dim { opacity: .6; }
  .sc-card .h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
  .sc-card .o { font-size: 13px; color: var(--muted); }
  .sc-card .t { font-weight: 700; }
  .sc-card .row { margin-top: 8px; align-items: end; }
  .chk { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 15px; color: var(--ink); }
  .chk input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--brand); }
  .src { font-size: 13px; color: var(--muted); }
  .src a { color: var(--gold); word-break: break-word; }
  .msg { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 15px; }
  .msg.ok { background: var(--ok-soft); color: var(--ok-ink); }
  .msg.err { background: var(--danger-soft); color: var(--danger-ink); }
  .msg.warn { background: var(--warn-soft); color: var(--warn-ink); }
  .banner { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; font-size: 15px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
  .banner button { flex: 0 0 auto; }
  /* เมนูล่าง 3 ปุ่ม: หน้าแรก · สรุป · เพิ่มเติม (โหมดตัวใหญ่: หน้าแรก · สรุป · ฉัน) ฟอร์มบันทึกเข้าจากปุ่มในหน้าแรก */
  nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: var(--nav); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
  nav.bottom button { position: relative; border: 0; border-radius: 0; background: none; padding: 10px 2px 10px; min-height: 62px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
  nav.bottom button[aria-current="page"] { color: var(--ink); font-weight: 600; }
  nav.bottom button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
  nav.bottom .simple-only { display: none; }
  .day { margin: 16px 0 6px; font-weight: 600; font-size: 15px; color: var(--muted); }
  .item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0; }
  .item .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
  .item .tag { font-size: 13px; color: var(--gold); font-weight: 600; }
  .item .val { font-size: 18px; font-weight: 600; margin: 2px 0; }
  .item .note { font-size: 14px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
  .item .acts { display: flex; gap: 8px; margin-top: 8px; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
  .stat .n { font-family: var(--serif); font-size: 23px; font-weight: 600; }
  .stat .l { font-size: 13px; color: var(--muted); }
  .quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  table.sum { width: 100%; border-collapse: collapse; font-size: 15px; margin: 6px 0; }
  table.sum th, table.sum td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
  table.sum th { color: var(--muted); font-weight: 500; }
  table.sum td.num { text-align: right; font-variant-numeric: tabular-nums; }
  .chart { width: 100%; height: auto; display: block; margin: 6px 0 2px; }
  .chart .ax { fill: var(--muted); }
  .chart .gr { stroke: var(--grid); }
  .chart .band { fill: var(--ok-soft); }
  .chart .bandl { fill: var(--ok-ink); }
  .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
  .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
  .report-head { border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 6px; }
  .report-head h2 { margin: 0; }
  .foot { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; margin-top: 12px; }
  .plan .bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 4px 0 10px; }
  .plan .bar i { display: block; height: 100%; background: var(--gold); }
  .plan .item { margin-top: 8px; }
  .qr-box { max-width: 300px; margin: 12px auto; background: #fff; padding: 8px; border-radius: 12px; }
  .qr-box svg { width: 100%; height: auto; display: block; }
  /* หน้าแรก */
  .tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 12px; min-height: 108px; border-radius: 16px; background: var(--brand-soft); border-color: transparent; text-align: left; }
  .tile .ic { color: var(--gold); width: 26px; height: 26px; }
  .tile b { font-family: var(--serif); font-weight: 600; font-size: 18px; }
  .tile small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
  .ses { text-align: left; padding: 12px 14px; min-height: 68px; border-radius: 14px; }
  .ses b { display: block; }
  .ses small { color: var(--muted); font-size: 13px; }
  .ses.done { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
  .ses.done small { color: var(--ok-ink); }
  .latest { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .latest:last-of-type { border-bottom: 0; }
  .latest .k b { display: block; }
  .latest .k small { color: var(--muted); font-size: 13px; line-height: 1.4; display: block; }
  .latest .v { font-family: var(--serif); font-size: 29px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
  .latest .v small { font-family: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 13px; font-weight: 400; color: var(--muted); display: block; }
  /* เมนู "เพิ่มเติม" */
  .menu { padding: 4px 18px; }
  .menu button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 14px 0; min-height: 68px; }
  .menu button:last-child { border-bottom: 0; }
  .menu .ic.lead { color: var(--gold); }
  .menu span { flex: 1; }
  .menu small { display: block; color: var(--muted); font-size: 13.5px; }
  .menu .chev { color: var(--muted); width: 18px; height: 18px; }
  .tiles.n1 { grid-template-columns: 1fr; }
  .tiles.n2, .tiles.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.n1 .tile { flex-direction: row; align-items: center; gap: 14px; min-height: 84px; }
  .tiles.n1 .tile b { flex: 1; font-size: 20px; }
  #f-more { margin-top: 10px; }
  .pick-list .mode-opt { align-items: center; min-height: 56px; }
  .pick-list .mode-opt.locked { background: var(--brand-soft); }
  /* ฟอร์มบันทึก */
  .time-now { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
  .rd-h { margin: 12px 0 0; font-weight: 600; font-size: 15px; }
  .rd-h + .row3 label { margin-top: 4px; }
  .mode { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
  .mode legend { font-size: 15px; color: var(--muted); padding: 0; margin-bottom: 2px; }
  .mode-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 6px 0; color: var(--ink); font-size: 16px; }
  .mode-opt input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--brand); }
  .mode-opt small { display: block; color: var(--muted); font-size: 13.5px; }
  /* โหมดง่าย: ตัวใหญ่ ปุ่มน้อย สำหรับผู้สูงอายุ */
  body.simple { font-size: 21px; }
  body.simple nav.bottom button { font-size: 17px; min-height: 72px; }
  body.simple nav.bottom button[data-view="more"], body.simple nav.bottom button[data-view="guide"] { display: none; }
  body.simple nav.bottom .simple-only { display: flex; }
  body.simple .card h2 { font-size: 25px; }
  body.simple #f-more { display: none; }
  body.simple input, body.simple select, body.simple button { font-size: 21px; }
  body.simple button.primary { padding: 18px; }
  body.simple .plan .item button { min-height: 56px; width: 100%; }
  body.simple .tiles { grid-template-columns: 1fr; }
  body.simple .tile { flex-direction: row; align-items: center; gap: 14px; min-height: 88px; padding: 16px; }
  body.simple .tile .ic { width: 34px; height: 34px; }
  body.simple .tile b { font-size: 24px; flex: 1; }
  body.simple .tile small { font-size: 15px; text-align: right; }
  body.simple .ses { min-height: 84px; }
  body.simple .ses small { font-size: 16px; }
  body.simple .latest .v { font-size: 34px; }
  body.simple .latest .k small { font-size: 15px; }
  dialog { border: 0; border-radius: var(--radius); padding: 20px; max-width: 520px; width: calc(100% - 28px); background: var(--card); color: var(--ink); }
  dialog::backdrop { background: rgba(10, 16, 24, .55); }
  dialog ul { padding-left: 20px; margin: 8px 0; }
  dialog li { margin: 6px 0; }
  /* คำเตือนค่าอันตราย: ต้องกดรับทราบ และโทร 1669 ได้ในปุ่มเดียว */
  #alert-dlg { border-top: 8px solid var(--danger-fill); }
  #alert-dlg .al-val { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1.2; color: var(--danger); margin: 2px 0 4px; }
  #alert-dlg p { margin: 10px 0; }
  #alert-dlg p.em { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger-line); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
  a.call { display: block; text-align: center; text-decoration: none; background: var(--danger-fill); color: #fff; font-weight: 700; font-size: 20px; border-radius: 12px; padding: 14px; margin-top: 14px; }
  #alert-dlg #al-ok { width: 100%; margin-top: 10px; padding: 13px; }
  body.simple a.call { font-size: 24px; padding: 18px; }
  body.simple #alert-dlg #al-ok { padding: 18px; }
  a[href^="tel:"]:not(.call) { color: inherit; font-weight: 700; }
  .check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; color: var(--ink); }
  .check input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--brand); }
  .seg.four[data-food-nav] button { font-size: 13.5px; }
  .fhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .fhead h2 { margin: 0; }
  .food-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; text-align: left; margin-top: 8px; background: var(--bg); border-color: transparent; }
  .food-row small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
  .food-row > span:last-child { text-align: right; white-space: nowrap; font-weight: 600; }
  #fd-results { max-height: 50vh; overflow-y: auto; }
  details summary { cursor: pointer; color: var(--gold); font-size: 15px; padding: 8px 0; }
  progress { accent-color: var(--brand); }

  /* ---------- จดปัสสาวะแบบเร็ว (bottom sheet) ---------- */
  dialog.sheet { margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); }
  .sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
  .bdq-head { display: flex; align-items: center; justify-content: space-between; }
  .bdq-head h2 { margin: 0; }
  .bdq-x { background: transparent; border: 0; font-size: 20px; min-width: 44px; min-height: 44px; color: var(--muted); }
  .bdq-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 14px; }
  .bdq-stats div { background: var(--brand-soft); border-radius: 16px; padding: 10px 8px; text-align: center; }
  .bdq-stats b { display: block; font-family: var(--serif); font-size: 24px; line-height: 1.1; color: var(--ink); }
  .bdq-stats small { color: var(--muted); font-size: 12.5px; }
  .bdq-stats .wide { grid-column: 1 / -1; text-align: left; padding: 8px 12px; font-size: 14px; color: var(--muted); }
  .bdq-mode { margin-bottom: 4px; }
  .bdq-mode button { min-height: 52px; font-size: 18px; }
  .bdq-q { margin: 14px 0 6px; font-weight: 600; } .bdq-q small { font-weight: 400; color: var(--muted); }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .chips button { min-height: 48px; min-width: 64px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font: inherit; font-size: 17px; line-height: 1.15; }
  .chips button small { display: block; font-size: 12px; color: var(--muted); }
  .chips button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
  .chips button[aria-pressed="true"] small { color: inherit; opacity: .85; }
  .chips.urg button[data-v="3"][aria-pressed="true"], .chips.urg button[data-v="4"][aria-pressed="true"] { background: #b4532a; }
  #bdq-vol, #bdq-ivol { margin-top: 8px; }
  .bdq-leak { display: flex; align-items: center; gap: 10px; margin-top: 12px; min-height: 48px; font-size: 17px; }
  .bdq-leak input { width: 24px; height: 24px; }
  .bdq-save { width: 100%; min-height: 58px; font-size: 19px; margin-top: 16px; }
  .bdq-save { position: sticky; bottom: 8px; z-index: 2; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .35); }
  .bdq-save:disabled { opacity: 1; filter: grayscale(.6) brightness(1.15); }
  .bdq-list { margin-top: 14px; }
  .bdq-list .it { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
  .bdq-list .it:last-child { border: 0; }
  .bdq-list .t { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 46px; }
  .bdq-list .d { flex: 1; }
  .bdq-list .del { background: transparent; border: 0; color: var(--muted); min-width: 44px; min-height: 40px; font: inherit; }
  .link-btn { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 12px 0 0; font: inherit; width: 100%; }
  body.simple .chips button { min-height: 56px; font-size: 19px; }

  /* ---------- หน้าบันทึกปัสสาวะ (ตามแอปอ้างอิง #24) ---------- */
  .bd-top { display: flex; justify-content: flex-end; gap: 18px; }
  .bd-top .link-btn { width: auto; padding: 4px 0; text-decoration: none; color: var(--ink); }
  .bd-h { font-family: var(--serif); font-size: 38px; margin: 2px 0 16px; }
  .bd-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .bd-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 16px; min-height: 172px;
    border-radius: 22px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; box-shadow: var(--shadow); }
  .bd-card.drink { background: var(--p-sky, #eef3f8); }
  .bd-card svg { width: 112px; height: 84px; }
  .bd-card span { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-top: auto; }
  .bd-card b { position: absolute; right: 16px; bottom: 14px; font-size: 30px; font-weight: 400; }
  .bd-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 92px; background: var(--brand-soft); }
  .bd-card.wide svg { width: 92px; height: 68px; }
  .bd-card.wide span { margin: 0; font-size: 24px; padding-right: 40px; } .bd-card.wide small { display: block; font-family: var(--sans, inherit); font-size: 14px; font-weight: 400; color: var(--muted); }
  .bd-card.wide b { top: 50%; bottom: auto; transform: translateY(-50%); }
  .bd-card .blob { fill: var(--p-mint, #e6efe9); } .bd-card.drink .blob { fill: var(--p-sky, #dfe9f3); } .bd-card.wide .blob { fill: var(--p-lilac, #ece8f6); }
  .bd-card .ln { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
  .bd-card .fill-u { fill: #f4e6b8; } .bd-card .fill-w { fill: #cfe1f1; } .bd-card .moon, .bd-card .sun { stroke: var(--gold); }
  .bd-list-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 8px; }
  .bd-list-head h2 { margin: 0; font-family: var(--serif); }
  .bd-list-head input { width: auto; }
  table.bd-t { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; font-variant-numeric: tabular-nums; }
  .bd-t th, .bd-t td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; }
  .bd-t th { font-weight: 500; color: var(--muted); font-size: 14px; } .bd-t th small { display: block; font-size: 12px; }
  .bd-t .n { text-align: center; font-size: 19px; } .bd-t .c-dr { background: rgba(120, 160, 200, .08); } .bd-t .c-vo { background: rgba(200, 180, 120, .08); }
  @media (max-width: 359px) { .bd-t th, .bd-t td { padding: 10px 4px; } .bd-t th { font-size: 12px; } .bd-t .n { font-size: 16px; } .bd-t .ed { min-width: 32px; } }
  .bd-t tr.mark td { font-weight: 700; background: var(--brand-soft); }
  .bd-t tr.tot td { font-weight: 700; border-bottom: 0; font-size: 18px; }
  .bd-t .ed { background: none; border: 0; color: var(--muted); min-width: 40px; min-height: 40px; font: inherit; font-size: 18px; }
  .bd-daysum { margin-top: 12px; padding: 14px 16px; border-radius: 16px; background: var(--brand-soft); font-size: 17px; }
  .bd-report-btn { width: 100%; margin-top: 14px; min-height: 54px; }
  .bdr-sec { margin: 18px 0 8px; font-family: var(--serif); }
  .bdr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .bdr-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
  .bdr-card h4 { margin: 0; font-size: 14.5px; } .bdr-card .en { color: var(--muted); font-size: 12px; }
  .bdr-card .v { font-family: var(--serif); font-size: 26px; margin: 6px 0 2px; }
  .bdr-card p { margin: 0; font-size: 13.5px; color: var(--muted); }
  .bdr-find { border-radius: 16px; padding: 12px 14px; margin: 8px 0; background: var(--brand-soft); }
  .bdr-find.see { background: var(--warn-soft, #fdf0dc); } .bdr-find.tip { background: var(--p-mint, #e6f4ee); }
  @media (max-width: 380px) { .bdr-grid { grid-template-columns: 1fr; } .bd-card span { font-size: 22px; } }

  /* ---------- dashboard หน้าแรก + เมนูด้านข้าง (#16, #18) ---------- */
  .dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin: 6px 0 14px; }
  .dash-head h1 { font-family: var(--serif); font-size: 30px; margin: 0; line-height: 1.15; }
  .dash-head p { margin: 0 0 2px; }
  .dash-range { flex: none; } .dash-range button { min-height: 34px; padding: 4px 10px; font-size: 13.5px; }
  .dash { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 14px; }
  .dcard { text-align: left; border: 1px solid var(--line); border-radius: 22px; padding: 14px; min-height: 150px; display: flex; flex-direction: column; gap: 2px;
    background: var(--card); color: var(--ink); font: inherit; box-shadow: var(--shadow); }
  .dash .dcard:nth-child(6n+1) { background: var(--p-rose); } .dash .dcard:nth-child(6n+2) { background: var(--p-mint); }
  .dash .dcard:nth-child(6n+3) { background: var(--p-lilac); } .dash .dcard:nth-child(6n+4) { background: var(--p-peach); }
  .dash .dcard:nth-child(6n+5) { background: var(--p-sky); } .dash .dcard:nth-child(6n+6) { background: var(--p-butter); }
  .dcard { min-width: 0; overflow-wrap: anywhere; } .dcard small { color: var(--muted); font-size: 13px; }
  .dcard .v { font-family: var(--serif); font-size: 32px; line-height: 1.1; margin-top: 6px; } .dcard .v i { font-style: normal; font-size: 13px; color: var(--muted); margin-left: 4px; }
  @media (max-width: 359px) { .dcard .v { font-size: 26px; } .dcard { padding: 12px; } }
  .dcard .v.none { font-size: 18px; color: var(--muted); }
  .dcard .st { font-size: 12.5px; } .dcard .st.ok { color: var(--ok); } .dcard .st.high, .dcard .st.watch { color: var(--warn); }
  .dcard svg.spark { width: 100%; height: 36px; margin-top: auto; }
  .spark .ln { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .spark .ar { fill: var(--brand); opacity: .10; } .spark .dt { fill: var(--brand); }
  :root[data-theme="dark"] .spark .ln { filter: drop-shadow(0 0 4px var(--brand)); }
  .menu-btn { width: 44px; height: 44px; border: 0; background: transparent; display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; padding: 10px; margin-left: -10px; }
  .menu-btn span { display: block; height: 2px; border-radius: 2px; background: var(--ink); }
  .menu-btn span:nth-child(2) { width: 70%; }
  dialog.drawer { margin: 0 auto 0 0; height: 100%; max-height: 100%; width: min(320px, 86vw); border-radius: 0 26px 26px 0; padding: calc(14px + env(safe-area-inset-top)) 16px 20px; }
  .drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  #view-menu.norange .dash-range { display: none; }
  .servs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
  .serv { position: relative; }
  .serv-add { width: 100%; text-align: left; border: 1.5px solid var(--line, rgba(0,0,0,.12)); background: var(--card, #fff); color: var(--ink); border-radius: 18px; padding: 12px 12px 10px; font: inherit; min-height: 112px; }
  .serv-add b { display: block; font-size: 15px; padding-right: 40px; line-height: 1.3; } .serv-add .sv { display: block; font-size: 26px; font-weight: 700; color: var(--brand); margin-top: 4px; } .serv-add .sv small { font-size: 15px; color: var(--muted); font-weight: 400; }
  .serv-add > small { color: var(--muted); font-size: 13px; }
  .serv-sub { position: absolute; top: 8px; right: 8px; min-width: 40px; min-height: 40px; padding: 0; font-size: 20px; border-radius: 12px; }
  .sbar { display: block; height: 6px; border-radius: 3px; background: var(--line, rgba(0,0,0,.1)); margin-top: 8px; overflow: hidden; }
  .sbar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; } .sbar i.over { background: var(--warn, #c46a2a); }
  p .sbar { display: block; width: 100%; margin: 6px 0 2px; }
  .chips-date input { width: auto; min-height: 40px; padding: 4px 10px; font-size: 15px; }
  .pads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
  .pad { position: relative; border: 1.5px solid var(--line, rgba(0,0,0,.12)); background: var(--card, #fff); border-radius: 18px; padding: 10px 4px 8px; text-align: center; color: var(--ink); font: inherit; min-height: 150px; }
  .pad svg { width: 64px; height: 92px; display: block; margin: 0 auto 4px; }
  .pad .body { fill: #fff; stroke: #d9c9c3; stroke-width: 2; } .pad .wing { fill: #f4ece8; stroke: #d9c9c3; stroke-width: 2; }
  .pad .blood { fill: #c43d4b; } .pad small { display: block; font-size: 13px; color: var(--muted); line-height: 1.25; }
  .pad .n { position: absolute; top: 6px; right: 8px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--brand); color: #fff; font-weight: 700; font-size: 15px; line-height: 26px; }
  .pad .n.z { background: transparent; color: var(--muted); border: 1px dashed var(--line, rgba(0,0,0,.2)); }
  .pad-minus { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
  .pad-minus button { min-height: 36px; padding: 2px; font-size: 14px; }
  .pcount { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
  .pcount .st { display: flex; align-items: center; gap: 6px; } .pcount .st button { min-width: 44px; min-height: 40px; padding: 0; font-size: 20px; } .pcount b { min-width: 24px; text-align: center; }
  .pscore { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-top: 12px; }
  .pscore .big { font-size: 30px; font-weight: 700; color: var(--brand); }
  .pstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
  .pstrip .wd { font-size: 12px; color: var(--muted); }
  .pstrip span.c { position: relative; display: block; border-radius: 10px; min-height: 38px; padding-top: 8px; font-size: 14px; }
  .pstrip .bl1 { background: #f7d4d8; } .pstrip .bl2 { background: #ef9aa5; } .pstrip .bl3 { background: #c43d4b; color: #fff; }
  .pstrip .pred { outline: 2px dashed #e17482; outline-offset: -3px; } .pstrip .fert { background: var(--lav, #e7e1f7); }
  .pstrip .ov::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--brand-2, #6e5fa3); }
  .pstrip .td { box-shadow: inset 0 0 0 2px var(--brand); font-weight: 700; }
  .vxl { list-style: none; margin: 0; padding: 0; }
  .vxl .age { margin: 14px 0 4px; font-size: 13px; letter-spacing: .06em; color: var(--muted); }
  .vxl li.v { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
  .vxl .tick { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--brand); background: transparent; padding: 0; color: #fff; font-size: 18px; }
  .vxl .done .tick { background: var(--brand); } .vxl .overdue .tick { border-color: var(--warn, #c46a2a); }
  .vxl .done .nm { color: var(--muted); } .vxl input[type=date] { width: auto; min-height: 36px; padding: 2px 8px; margin-top: 4px; font-size: 14px; }
  .vnext { border-radius: 18px; padding: 14px; background: var(--brand-soft); margin-bottom: 8px; }
  .vnext.late { background: color-mix(in srgb, var(--warn, #c46a2a) 18%, transparent); }
  .vxl .cond .tick { border-style: dashed; border-color: var(--muted); }
  .gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line, rgba(0,0,0,.15)); background: #fff; color: #1f1f1f; font: inherit; font-weight: 600; }
  .gbtn svg { width: 22px; height: 22px; }
  .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0; } .or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line, rgba(0,0,0,.12)); }
  .codein { font-size: 26px; letter-spacing: .4em; text-align: center; }
  .acct-row { display: flex; align-items: center; gap: 12px; } .acct-row .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 18px; flex: none; }
  .acct-row b { display: block; word-break: break-all; }
  .calm { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin-top: 8px; }
  .calm .wd { font-size: 12px; color: var(--muted); padding: 4px 0; }
  .calm button { position: relative; min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: inherit; font-size: 16px; padding: 4px 0 12px; }
  .calm button.out { visibility: hidden; }
  .calm button.today { background: var(--brand-soft); font-weight: 700; }
  .calm button[aria-pressed="true"] { outline: 2px solid var(--brand); }
  .calm .dots { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; justify-content: center; gap: 3px; }
  .calm .dots i, .calm-key .k { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
  .k.appt { background: var(--brand); } .k.due { background: var(--warn, #c46a2a); } .k.log { background: var(--muted); opacity: .6; }
  .calm-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
  .calm-key .k { margin-right: 6px; }
  .cal-nav { min-width: 44px; padding: 6px 10px; }
  .vtl { list-style: none; margin: 8px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--line, rgba(0,0,0,.12)); }
  .vtl li { position: relative; padding: 4px 0 14px 10px; }
  .vtl li::before { content: ''; position: absolute; left: -25px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--card, #fff); border: 2px solid var(--brand); }
  .vtl li.screen::before { border-color: var(--brand-2, #6e5fa3); }
  .vtl li.due::before, .vtl li.missed::before { background: var(--warn, #c46a2a); border-color: var(--warn, #c46a2a); }
  .vtl li.done { opacity: 1; } .vtl li.done::before { background: var(--muted); border-color: var(--muted); }
  .vtl li.nowline { padding: 0 0 12px 10px; color: var(--brand); font-weight: 700; font-size: 13px; }
  .vtl li.nowline::before { background: var(--brand); }
  .vtl .d { font-size: 13px; color: var(--muted); } .vtl b { display: block; }
  .vtl .acts { display: flex; gap: 8px; margin-top: 6px; } .vtl .acts button { min-height: 40px; padding: 4px 12px; font-size: 15px; }
  .todo { list-style: none; margin: 8px 0 0; padding: 0; }
  .todo button { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; min-height: 48px; padding: 6px 4px; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
  .todo button::before { content: ''; width: 18px; height: 18px; flex: none; border-radius: 6px; border: 2px solid var(--brand); }
  .streak { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 14px; }
  .streak b { font-size: 18px; }
  .drawer-list { display: flex; flex-direction: column; gap: 4px; }
  .drawer-list .grp { margin: 14px 4px 4px; font-size: 12px; letter-spacing: .12em; color: var(--muted); }
  .drawer-list button { display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; min-height: 48px; padding: 6px 10px; border-radius: 14px; }
  .drawer-list button:hover, .drawer-list button[aria-current="page"] { background: var(--brand-soft); }
  .drawer-list .drawer-out { margin-top: 10px; border-top: 1px solid var(--line, rgba(127,127,127,.2)); border-radius: 0 0 14px 14px; color: var(--danger, #d64545); }
  .drawer-list .ic { width: 22px; height: 22px; color: var(--brand); flex: none; }
  header.top { justify-content: flex-start; gap: 6px; } #top-back { margin-left: auto; }

  /* ---------- แม่แบบหน้าเมนูสุขภาพ (#19) ---------- */
  .mh { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
  .mh h1 { font-family: var(--serif); font-size: 30px; margin: 0; flex: 1; }
  .mh-ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--p-rose); color: var(--brand); }
  .mh-ic .ic { width: 26px; height: 26px; }
  .mh-hint { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 19px; font-weight: 700; }
  .mh-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .mh-row h2 { margin: 0; }
  .bpin { display: grid; grid-template-columns: 70px 1fr 1fr 1fr; gap: 8px; align-items: end; margin-top: 10px; }
  .bpin label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
  .bpin .rl { font-size: 14px; color: var(--muted); padding-bottom: 14px; }
  .bpin input { font-family: var(--serif); font-size: 24px; text-align: center; padding: 8px 4px; }
  .mchart { width: 100%; height: auto; margin-top: 10px; }
  .mchart .bh { fill: color-mix(in srgb, var(--warn) 12%, transparent); } .mchart .bg { fill: color-mix(in srgb, var(--ok) 10%, transparent); }
  .mchart .gl { stroke: var(--line); } .mchart .th { stroke: var(--warn); stroke-dasharray: 4 4; }
  .mchart .s { fill: none; stroke: var(--brand); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
  .mchart .d { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 2 3; }
  .mchart text { font-size: 10px; fill: var(--muted); font-family: inherit; }
  .mchart .pt { fill: var(--brand); } .mchart .pt.hi { fill: var(--warn); } .mchart .mk { fill: var(--gold); }
  :root[data-theme="dark"] .mchart .s { filter: drop-shadow(0 0 4px var(--brand)); }
  .msum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
  .pill { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 15px; }
  .pill.ok { background: var(--ok-soft); color: var(--ok-ink); } .pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
  .msum .kv { font-size: 15px; } .msum .kv b { font-family: var(--serif); font-size: 20px; }
  .adv li { margin: 6px 0; } .tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); margin-left: 6px; vertical-align: middle; }
  .hint-ill { display: block; width: 100%; max-width: 320px; margin: 4px auto 10px; }
  .hint-ill .ln { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; } .hint-ill .cf { fill: var(--p-rose); } .hint-ill .tb { fill: var(--p-lilac); }
  .wring { display: flex; align-items: center; gap: 16px; } .ring { width: 110px; height: 110px; flex: none; }
  .ring .rt { fill: none; stroke: var(--line); stroke-width: 12; } .ring .rv { fill: none; stroke: var(--brand); stroke-width: 12; stroke-linecap: round; }
  :root[data-theme="dark"] .ring .rv { filter: drop-shadow(0 0 6px var(--brand)); }
  .wv { font-family: var(--serif); font-size: 36px; } .wv small { font-size: 15px; color: var(--muted); }
  dialog.reg { width: min(460px, 94vw); max-height: 94vh; overflow: auto; border-radius: 26px; padding: 22px 20px; }
  .reg .rstep > button.primary, .reg .rnav .primary { width: 100%; min-height: 54px; margin-top: 14px; }
  .reg .rnav { display: flex; gap: 10px; align-items: center; } .reg .rnav > button:first-child { flex: 0 0 auto; min-height: 54px; margin-top: 14px; padding: 0 18px; }
  .reg label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
  .reg .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .reg-logo { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0 10px; }
  .reg-logo img { width: 72px; height: 72px; } .reg-logo span { font-family: var(--serif); font-size: 30px; letter-spacing: .2em; color: var(--brand); } .reg-logo small { color: var(--muted); }
  .rprog { margin: 0; font-size: 13px; color: var(--muted); }
  .chips.rank button[data-rank]::before { content: attr(data-rank); display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: var(--cv-on-brand); color: var(--brand); font-size: 13px; font-weight: 700; }
  .rlabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
  .dash-tools { display: flex; justify-content: flex-end; margin: -6px 2px 10px; }
  .dash.editing .dcard { outline: 2px dashed var(--line); }
  .dmove { display: flex; gap: 8px; margin-top: 6px; } .dmove span { flex: 1; text-align: center; padding: 6px 0; border-radius: 12px; background: var(--card); font-size: 18px; border: 1px solid var(--line); }
  .dmove span[aria-disabled="true"] { opacity: .3; pointer-events: none; }
  @media print {
    @page { size: A4; margin: 12mm; }
    body { background: #fff; padding: 0; font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .card h3 { margin: 8px 0 2px; font-size: 11.5pt; }
    table.sum { font-size: 10pt; margin: 2px 0; }
    table.sum th, table.sum td { padding: 2px 4px; }
    .chart { max-width: 150mm; margin: 0; }
    .muted, .foot, .legend { font-size: 9pt; }
    p.muted { margin: 2px 0; }
    header.top, nav.bottom, .banner, .no-print, #view-home, #view-more, #view-add, #view-history, #view-food, #view-guide, #view-settings { display: none !important; }
    #view-summary { display: block !important; }
    main { max-width: none; padding: 0; }
    .card { border: 0; padding: 0; margin: 0 0 10px; box-shadow: none; }
    .section-print { break-inside: avoid; }
    a[href^="tel:"] { text-decoration: none; }
  }

  /* ===== ธีม CHEEVA "Lotus Dusk" (สีจาก ../shared/brand.css) · สว่าง = pastel หรู · มืด = neon เล็กน้อย · เฉพาะบนจอ ===== */
  @media screen {
    :root, :root[data-theme="dark"] {
      --bg: var(--cv-bg); --card: var(--cv-card); --field: var(--cv-field); --ink: var(--cv-ink); --muted: var(--cv-mute); --line: var(--cv-line);
      --brand: var(--cv-brand); --brand-ink: var(--cv-on-brand); --brand-soft: var(--cv-lav); --gold: var(--cv-accent); --gold-soft: var(--cv-apricot);
      --nav: color-mix(in srgb, var(--cv-solid) 78%, transparent); --radius: 22px; --focus: var(--cv-brand-2); --shadow: var(--cv-shadow);
      --p-lilac: var(--cv-lav); --p-mint: var(--cv-sage); --p-peach: var(--cv-apricot); --p-sky: var(--cv-sky); --p-butter: var(--cv-butter); --p-rose: var(--cv-rose);
      --grad-brand: var(--cv-grad); --glow: var(--cv-glow);
    }
    :root:not([data-theme="dark"]) { --glow: none; }
    html {
      background:
        radial-gradient(900px 520px at 100% -10%, var(--cv-blob2) 0%, transparent 60%),
        radial-gradient(700px 480px at -10% 15%, var(--cv-blob1) 0%, transparent 55%),
        radial-gradient(800px 600px at 50% 110%, var(--cv-blob3) 0%, transparent 60%),
        var(--bg);
    }
    body { background: transparent; }
    :root:not([data-theme="dark"]) .card { border-color: rgba(255, 255, 255, .7); }
    button.primary { background: var(--grad-brand); border-color: transparent; color: var(--cv-on-brand); box-shadow: var(--cv-glow); }
    button.primary:active { transform: translateY(1px); }
    .tile { border: 1px solid var(--line); box-shadow: var(--shadow); }
    .tiles .tile:nth-child(6n+1) { background: var(--p-rose); }
    .tiles .tile:nth-child(6n+2) { background: var(--p-mint); }
    .tiles .tile:nth-child(6n+3) { background: var(--p-lilac); }
    .tiles .tile:nth-child(6n+4) { background: var(--p-peach); }
    .tiles .tile:nth-child(6n+5) { background: var(--p-sky); }
    .tiles .tile:nth-child(6n+6) { background: var(--p-butter); }
    .tile .ic { color: var(--brand); }
    .seg button[aria-pressed="true"], .quick button[aria-pressed="true"] { background: var(--grad-brand); color: var(--cv-on-brand); border-color: transparent; box-shadow: var(--glow); }
    input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cv-brand-2) 22%, transparent); }
    dialog { background: var(--cv-solid); box-shadow: 0 30px 60px -20px rgba(42, 36, 48, .35); }
    dialog::backdrop { background: rgba(20, 16, 30, .5); }
    :root[data-theme="dark"] dialog { border: 1px solid var(--line); box-shadow: 0 0 40px rgba(139, 123, 255, .2); }
    :root[data-theme="dark"] dialog::backdrop { background: rgba(4, 3, 10, .72); }
    :root[data-theme="dark"] .tile .ic { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--cv-brand) 60%, transparent)); }
    :root[data-theme="dark"] .hero h1, :root[data-theme="dark"] .bd-h { background: linear-gradient(90deg, var(--cv-ink), #ffb3ea 55%, #b4a9ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
    @media (prefers-reduced-motion: no-preference) { button.primary, .tile { transition: transform .15s ease, box-shadow .2s ease; } }
  }
  /* อ่านน้อย: คำอธิบายยาวพับไว้ กด "อ่านเพิ่ม" เพื่อเปิด */
  .fold-hide { display: none !important; }
  .fold-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
  .gfold > h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; margin-bottom: 0; min-height: 44px; }
  .gfold > h2::after { content: "›"; font-size: 1.3em; color: var(--muted); transition: transform .15s; }
  .gfold.open > h2::after { transform: rotate(90deg); }
  .gfold.open > h2 { margin-bottom: 10px; }
  @media print { .fold-hide { display: revert !important; } .fold-btn { display: none; } }
  .rquick { display: block; width: 100%; margin-top: 10px; min-height: 44px; background: none; border: 0; color: var(--mute, #666); text-decoration: underline; cursor: pointer; }
  /* IPSS */
  .ip-flags { display: grid; gap: 8px; }
  .ip-flag { text-align: left; min-height: 52px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
  .ip-flag[aria-pressed="true"] { border-color: #c0392b; background: color-mix(in srgb, #c0392b 10%, var(--card)); font-weight: 600; }
  .ip-opts { display: grid; gap: 8px; margin: 12px 0; }
  .ip-opts button { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 54px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 17px; }
  .ip-opts button b { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--line); flex: none; }
  .ip-opts button[aria-pressed="true"] { border-color: var(--brand, #0f5a50); }
  .ip-opts button[aria-pressed="true"] b { background: var(--brand, #0f5a50); color: #fff; }
  .ip-score b { font: 700 54px/1 "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif; } .ip-score span { color: var(--muted); margin-left: 6px; }
  .ip-ask { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
  .ip-opt { border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; margin: 8px 0; background: var(--card); }
  .ip-opt summary { cursor: pointer; padding: 10px 0; min-height: 44px; list-style-position: outside; }
  .ip-opt summary small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
  .ip-opt p { margin: 0 0 10px; }
  .ip-prio button b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--brand, #0f5a50); font-size: 13px; margin-right: 4px; }
  .ip-best { margin-top: 14px; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--brand, #0f5a50); background: color-mix(in srgb, var(--brand, #0f5a50) 7%, var(--card)); }
  .ip-best small { display: block; color: var(--muted); } .ip-best > b { display: block; font-size: 19px; margin: 2px 0 6px; }
  .ip-best p { margin: 0 0 6px; } .ip-best .ok { color: #1f7a4d; } .ip-best .no { color: #b3261e; }

  /* ===== ภารกิจวันนี้ + ต้นชีวา ===== */
  .ms-card { overflow: hidden; position: relative; }
  .ms-head { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: center; }
  .ms-tree { position: relative; padding: 0; border: 0; background: radial-gradient(circle at 50% 70%, rgba(92, 196, 141, .18), transparent 70%); border-radius: 22px; min-height: 0; width: 112px; height: 112px; }
  .ms-tree.bounce .cv-tree { animation: msBounce .6s cubic-bezier(.3, 1.6, .5, 1); }
  .ms-stat p { margin: 0; }
  .ms-k { font-size: 13px; color: var(--muted); margin: 0; }
  .ms-pts { font-family: var(--serif); font-size: 15px; color: var(--muted); }
  .ms-pts b { font-size: 30px; color: var(--ink); margin-right: 4px; }
  .ms-bar { height: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; margin: 6px 0 4px; }
  .ms-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3fae7a, #8be0b0); transform-origin: left; animation: msGrowX .9s cubic-bezier(.2, .8, .2, 1); }
  .ms-streak { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px !important; font-size: 14px; color: var(--muted); }
  .ms-streak .flame.on { color: var(--flame, #e8590c); font-weight: 700; }
  .ms-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
  .ms-row { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: background .3s, border-color .3s; }
  .ms-row::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #7fd6a3; }
  .ms-row.t-med::before { background: #f2b544; }
  .ms-row.t-hard::before { background: #ef6f8c; }
  .ms-row.done { background: var(--ok-soft); border-color: var(--ok-line); }
  .ms-check { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); background: var(--card); }
  .ms-check svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; }
  .ms-row.done .ms-check { background: var(--ok); border-color: var(--ok); }
  .ms-row.done .ms-check svg { stroke-dashoffset: 0; transition: stroke-dashoffset .35s ease .05s; }
  .ms-txt { text-align: left; border: 0; background: none; padding: 0; min-height: 0; color: var(--ink); font: inherit; min-width: 0; }
  .ms-txt b { display: block; font-weight: 600; line-height: 1.35; }
  .ms-txt small { color: var(--muted); font-size: 13px; }
  .ms-row.done .ms-txt b { color: var(--ok-ink); }
  .ms-tier { font-weight: 700; }
  .t-easy .ms-tier { color: #2f9466; } .t-med .ms-tier { color: #b7791f; } .t-hard .ms-tier { color: #d0456a; }
  .ms-swap { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; color: var(--muted); font-size: 18px; }
  .ms-honest { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
  .ms-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
  .ms-cfg { margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--brand-soft); }
  .ms-float { position: absolute; right: 52px; top: 6px; font-weight: 800; color: var(--ok); font-family: var(--serif); pointer-events: none; animation: msFloat 1.1s ease-out forwards; }
  .ms-burst { position: absolute; left: 50%; top: 45%; width: 10px; height: 6px; border-radius: 6px 0; background: #5cc48d; pointer-events: none; animation: msBurst 1.1s ease-out forwards; }
  .ms-dialog { width: min(440px, 94vw); border: 0; border-radius: 22px; padding: 18px; background: var(--card); color: var(--ink); }
  .ms-dialog::backdrop { background: rgba(10, 8, 20, .55); }
  .ms-wtree { text-align: center; }
  .ms-wtree p { margin: 0; color: var(--muted); }
  .ms-wgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; text-align: center; }
  .ms-wgrid div { padding: 10px 4px; border-radius: 14px; background: var(--brand-soft); }
  .ms-wgrid b { display: block; font-family: var(--serif); font-size: 20px; }
  .ms-wgrid small { font-size: 12px; color: var(--muted); }
  .ms-gains { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
  .ms-team { margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px dashed var(--line); }
  .ms-team small { display: block; color: var(--muted); }

  /* ต้นไม้: งอก ใบผลิ ลมพัด */
  .cv-tree { width: 100%; height: 100%; overflow: visible; }
  .cv-tree.big { width: 200px; height: 200px; }
  .cv-tree .tr-soil { fill: rgba(138, 90, 50, .18); }
  .cv-tree .tr-grow { stroke-dasharray: 140; stroke-dashoffset: 140; animation: trGrow 1s cubic-bezier(.3, .7, .3, 1) forwards; }
  .cv-tree .tr-leaf { transform-box: fill-box; transform-origin: center; transform: scale(0); animation: trLeaf .55s cubic-bezier(.3, 1.6, .5, 1) forwards; animation-delay: var(--d, .3s); }
  .cv-tree .tr-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: trSway 5.5s ease-in-out 1.2s infinite; }
  .cv-tree.thirsty { filter: saturate(.35) brightness(.95); }
  .cv-home-brand img { animation: trSway 6s ease-in-out infinite; transform-origin: 50% 90%; }

  /* หน้าเปลี่ยน: ค่อยๆ ขึ้นมา · การ์ดที่เลื่อนเข้าจอ: โผล่ขึ้น */
  main > section:not(.hidden) { animation: cvViewIn .35s ease-out; }
  .cv-rv { opacity: 0; transform: translateY(18px) scale(.98); transition: opacity .55s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
  .cv-rv.cv-in { opacity: 1; transform: none; }
  .cv-vine { position: fixed; left: 3px; top: 64px; bottom: 80px; width: 14px; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .4s; }
  .cv-vine.on { opacity: .9; }
  .cv-vine i { position: absolute; left: 6px; top: 0; bottom: 0; width: 3px; border-radius: 3px; background: linear-gradient(180deg, #2f9466, #5cc48d 60%, #ff8fcf); transform-origin: top; transform: scaleY(0); }
  .cv-vine b { position: absolute; width: 11px; height: 7px; border-radius: 9px 0; background: #5cc48d; transform: scale(0) rotate(-30deg); transition: transform .45s cubic-bezier(.3,1.6,.5,1); }
  .cv-vine b.l { left: -1px; } .cv-vine b.r { left: 8px; border-radius: 0 9px; transform: scale(0) rotate(30deg); }
  .cv-vine b.on { transform: scale(1) rotate(-30deg); } .cv-vine b.r.on { transform: scale(1) rotate(30deg); }

  @keyframes trGrow { to { stroke-dashoffset: 0; } }
  @keyframes trLeaf { to { transform: scale(1); } }
  @keyframes trSway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
  @keyframes msBounce { 0% { transform: scale(1); } 40% { transform: scale(1.12) translateY(-4px); } 100% { transform: scale(1); } }
  @keyframes msGrowX { from { transform: scaleX(0); } }
  @keyframes msFloat { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-28px); } }
  @keyframes msBurst { 0% { opacity: 1; transform: translate(-50%, 0) rotate(0); } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), -70px) rotate(var(--r)); } }
  @keyframes cvViewIn { from { opacity: 0; transform: translateY(10px); } }
  .cv-still .cv-tree .tr-grow, .cv-still .cv-tree .tr-leaf, .cv-still .cv-tree .tr-sway, .cv-still .cv-home-brand img, .cv-still main > section:not(.hidden), .cv-still .ms-bar i, .cv-still .qz-res { animation: none !important; stroke-dashoffset: 0; transform: none; }
  @media print { .ms-card, .cv-vine { display: none !important; } }

  /* ===== log พฤติกรรม: หวาน บุหรี่ แอลกอฮอล์ ยา วัคซีน ===== */
  .sweet-lv button small { display: block; font-size: 11px; color: var(--muted); }
  .sweet-lv .lv0, .sweet-lv .lv25 { border-color: var(--ok-line); }
  .sweet-lv .lv75, .sweet-lv .lv100 { border-color: var(--warn-line); }
  .chips button.ok { border-color: var(--ok); color: var(--ok); font-weight: 700; }
  .med-edit { margin-top: 12px; }
  .med-edit summary { cursor: pointer; font-weight: 600; color: var(--brand); }
  .med-li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .med-li:last-of-type { border-bottom: 0; }
  .eh { font-size: 16px; margin: 14px 0 6px; }
  .eh:first-child { margin-top: 0; }
  .eh small { font-weight: 400; color: var(--muted); font-size: 13px; }
  .chips button.warn { border-color: var(--danger-line); color: var(--danger); }

  /* ===== ครอบครัว ===== */
  #who-badge { margin: 0 0 8px; }
  .who-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 99px; font-size: 14px; }
  .who-chip.other { background: #fff1c7; border-color: #f2c94c; color: #6b4a00; font-weight: 700; }
  :root[data-theme="dark"] .who-chip.other { background: #3a2c08; color: #ffd86b; border-color: #8a6a12; }
  .cv-other .cv-home-brand::after { content: ""; }
  .who-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .who-pick { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none; padding: 6px 4px; }
  .who-pick small { display: block; color: var(--muted); font-size: 13px; }
  .who-row.on .who-pick b { color: var(--ok); }
  .who-em { font-size: 28px; width: 40px; text-align: center; }
  #who-add details { margin-top: 12px; }
  #who-add summary { cursor: pointer; font-weight: 700; color: var(--brand); }
  .link.danger { color: var(--danger); }
  /* หัวการ์ดแนวโน้ม: ตัวอักษรใหญ่ (โหมดง่าย) ไม่ให้คำหักครึ่ง */
  .mh-row { flex-wrap: wrap; row-gap: 8px; }
  .mh-row h2 { white-space: nowrap; }

  /* ===== จริงหรือมั่ว ===== */
  .qz-q { font-family: var(--serif); font-size: 19px; line-height: 1.45; margin: 8px 0 12px; }
  .qz-btn button { min-height: 56px; font-size: 18px; font-weight: 700; }
  .qz-res { padding: 12px 14px; border-radius: 14px; animation: cvViewIn .35s ease-out; }
  .qz-res.ok { background: var(--ok-soft); color: var(--ok-ink); }
  .qz-res.no { background: var(--warn-soft); color: var(--warn-ink); }
  .qz-res p { margin: 6px 0; }
  .qz-res small { opacity: .8; font-size: 12px; }

  /* ===== ตัวหนังสือน้อย ไอคอนมาก ===== */
  .gtiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
  .gtile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px 8px; min-height: 92px; border-radius: 18px; background: var(--brand-soft); border: 1px solid transparent; text-align: center; }
  .gtile .gi { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: 0 2px 8px rgba(20, 32, 46, .08); }
  .gtile .gi .ic { width: 24px; height: 24px; color: var(--gold); }
  .gtile b { font-size: 13px; font-weight: 600; line-height: 1.2; }
  .gtile small { font-size: 12px; color: var(--ok); font-weight: 700; min-height: 14px; }
  .gtile.done .gi { background: var(--ok); }
  .gtile.done .gi .ic { color: #fff; }
  body.simple .gtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.simple .gtile b { font-size: 16px; }
  .log-card .fhead h2 { margin: 0; }
  .icon-only { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; font-size: 18px; color: var(--muted); }
  .mtabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding: 2px; scrollbar-width: none; }
  .mtabs button { flex: 0 0 auto; min-height: 40px; padding: 6px 16px; border-radius: 99px; font-weight: 700; }
  .mtabs button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .mod-group { margin-bottom: 10px; }
  .mod-gh { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-weight: 700; color: var(--muted); font-size: 14px; }
  .mod-gh .ic { width: 18px; height: 18px; }
  .mod-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .mod-chip { position: relative; }
  .mod-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
  .mod-chip span { display: inline-block; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }
  .mod-chip input:checked + span { background: var(--ok); color: #fff; border-color: var(--ok); }
  .mod-chip input:focus-visible + span { outline: 3px solid var(--focus); }
  .mod-chip.locked span { opacity: .8; }
  .adv-d summary, .todo-d summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
  .adv-d summary::-webkit-details-marker, .todo-d summary::-webkit-details-marker { display: none; }
  .adv-d[open] summary, .todo-d[open] summary { margin-bottom: 8px; }
  .rowlink { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; color: var(--ink); }
  .rowlink .muted { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rowlink i { font-style: normal; font-size: 22px; color: var(--muted); }
  .icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
  .icon-btn .ic { width: 20px; height: 20px; }
  .info-i { width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; font-size: 14px; color: var(--muted); vertical-align: middle; margin-left: 4px; }
  .ms-info { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); font-size: 13px; }
  .ms-info p { margin: 0 0 4px; }
  .ms-foot button { min-height: 38px; padding: 4px 14px; border-radius: 99px; font-size: 14px; }
  .faint { opacity: .45; }
  .dash-tools .link#dash-edit { font-size: 18px; }
  .ms-emo { margin-right: 6px; }
  .dash-tools { justify-content: space-between; align-items: center; margin: 4px 2px 10px; }
  .dash-tools .dash-range button { min-height: 34px; padding: 4px 12px; font-size: 13px; }
  #view-home .dash-head { padding-top: 14px !important; padding-bottom: 14px !important; min-height: 0 !important; }
  #view-home .dash-head h1 { font-size: 24px; margin: 0; }
  details.inl { display: inline; }
  details.inl summary { display: inline; cursor: pointer; color: var(--brand); list-style: none; }
  details.inl summary::-webkit-details-marker { display: none; }
  details.inl[open] small { display: block; color: var(--muted); margin-top: 4px; }

  /* ===== หน้าแรกมีชีวิต: CHEEVA Score · มาสคอต · วงแหวน · ปุ่ม + · เอฟเฟกต์ ===== */
  #cv-hero:empty { display: none; }
  .hero-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 16px; margin: 6px 0 12px; border-radius: 26px; background: radial-gradient(120% 100% at 0% 0%, rgba(255,122,217,.18), transparent 60%), radial-gradient(120% 100% at 100% 100%, rgba(47,213,181,.16), transparent 60%), var(--card); border: 1px solid var(--line); overflow: hidden; }
  .hero-ring { position: relative; width: 168px; height: 168px; }
  .hero-ring svg { display: block; }
  .rg-bg { fill: none; stroke: var(--line); }
  .rg-fg { animation: rgIn 1.1s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes rgIn { from { stroke-dashoffset: var(--c); } to { stroke-dashoffset: var(--o); } }
  .hero-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .hero-num b { font-size: 50px; line-height: 1; font-weight: 800; letter-spacing: -.02em; background: linear-gradient(135deg, #ff7ad9, #2fd5b5); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
  .hero-num small { font-size: 10px; letter-spacing: .14em; color: var(--muted); margin-top: 4px; }
  .hero-side { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
  .hero-mascot { position: relative; background: none; border: 0; padding: 0; min-height: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .mc-play { display: inline-block; transform-origin: 50% 90%; }
  .mc-play .cv-mascot { animation: none; }
  .mc-p-spin { animation: mcpSpin .9s cubic-bezier(.3,1.4,.5,1); }
  .mc-p-wiggle { animation: mcpWiggle .8s ease-in-out; }
  .mc-p-jump { animation: mcpJump .8s cubic-bezier(.3,1.6,.5,1); }
  .mc-p-dance { animation: mcpDance 1.2s ease-in-out; }
  .mc-p-bounce { animation: mcpBounce .9s cubic-bezier(.3,1.6,.5,1); }
  .mc-p-sway { animation: mcpSway 1.4s ease-in-out; }
  .mc-p-tickle { animation: mcpTickle .12s linear 10; }
  .mc-p-dance .mc-sprout, .mc-p-tickle .mc-sprout { animation: mcSprout .3s ease-in-out infinite; }
  .mc-bit { position: absolute; left: 50%; top: 50%; pointer-events: none; opacity: 0; animation: mcpBit 1.1s ease-out var(--d) forwards; }
  .mc-bubble { position: absolute; left: 50%; top: 2px; transform: translate(-50%, 0); white-space: nowrap; pointer-events: none; padding: 5px 11px; border-radius: 14px; background: var(--cv-solid, var(--card, #fff)); color: var(--ink, #2b1d2e); font-size: 13px; font-weight: 700; box-shadow: 0 6px 18px rgba(43,29,46,.16); animation: mcpBubble 1.8s ease forwards; z-index: 2; }
  .mc-bubble::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: inherit; transform: translateX(-50%) rotate(45deg); }
  @keyframes mcpSpin { 0% { transform: translateY(0) rotate(0); } 45% { transform: translateY(-22px) rotate(200deg); } 80% { transform: translateY(0) rotate(360deg) scale(1.08,.92); } 100% { transform: rotate(360deg); } }
  @keyframes mcpWiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-7deg); } 80% { transform: rotate(4deg); } }
  @keyframes mcpJump { 0%,100% { transform: translateY(0) scale(1); } 15% { transform: scale(1.12,.86); } 45% { transform: translateY(-26px) scale(.94,1.08); } 75% { transform: translateY(0) scale(1.1,.9); } }
  @keyframes mcpDance { 0%,100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-8px) rotate(-10deg); } 40% { transform: translateX(8px) rotate(10deg) translateY(-6px); } 60% { transform: translateX(-8px) rotate(-10deg); } 80% { transform: translateX(8px) rotate(10deg) translateY(-6px); } }
  @keyframes mcpBounce { 0%,100% { transform: scale(1); } 20% { transform: scale(1.18,.8); } 40% { transform: translateY(-14px) scale(.9,1.1); } 60% { transform: scale(1.08,.92); } 80% { transform: translateY(-5px); } }
  @keyframes mcpSway { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
  @keyframes mcpTickle { 0%,100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-3px) rotate(-4deg); } 75% { transform: translateX(3px) rotate(4deg); } }
  @keyframes mcpBit { 0% { opacity: 0; transform: translate(-50%, 0) scale(.4); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), var(--y)) scale(1.1) rotate(25deg); } }
  @keyframes mcpBubble { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
  .hero-delta { margin: 4px 0 0; font-weight: 700; font-size: 14px; color: var(--muted); }
  .hero-delta.up { color: var(--up-ink); } .hero-delta.down { color: var(--down-ink); }
  .hero-sub { margin: 0; font-size: 13px; color: var(--muted); }
  .info-i { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 15px; }
  .hero-info { grid-column: 1 / -1; font-size: 13px; color: var(--muted); text-align: center; padding: 8px; border-radius: 12px; background: var(--brand-soft); }
  .w-rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
  .w-ring { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 0; }
  .w-ring b { font-size: 15px; } .w-ring small { font-size: 12px; color: var(--muted); }
  /* มาสคอต */
  .cv-mascot { display: block; overflow: visible; transform-origin: 50% 100%; animation: mcBob 3.2s ease-in-out infinite; }
  .mc-ln { stroke: #2b1d2e; stroke-width: 3.4; fill: none; stroke-linecap: round; }
  .mc-eyes { transform-origin: 60px 101px; animation: mcBlink 4.5s infinite; }
  .mc-arm { transform-origin: 92px 112px; animation: mcWave .6s ease-in-out 4 alternate; }
  .mc-z { font: 700 16px sans-serif; fill: #8b7cff; animation: mcZ 2.4s ease-in-out infinite; }
  .mc-sprout { transform-origin: 60px 52px; animation: mcSprout 2.6s ease-in-out infinite; }
  .mc-happy { animation: mcJump .9s cubic-bezier(.3,1.6,.5,1) 2, mcBob 3.2s ease-in-out 1.8s infinite; }
  .mc-worried { animation: mcShake 2.8s ease-in-out infinite; }
  .mc-thin { stroke-width: 2.6; } .mc-z2 { animation-delay: .8s; }
  .hero-sub.mc-stage { font-size: 12px; margin: 0; }
  .hero-say { margin: 2px 0 0; font-size: 12.5px; font-weight: 600; color: var(--text, inherit); }
  .mc-poke { animation: mcPoke .5s cubic-bezier(.3,1.6,.5,1); }
  @keyframes mcBob { 0%,100% { transform: translateY(0) scale(1,1); } 50% { transform: translateY(-4px) scale(1.02,.98); } }
  @keyframes mcBlink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
  @keyframes mcWave { from { transform: rotate(-12deg); } to { transform: rotate(18deg); } }
  @keyframes mcZ { 0% { opacity: 0; transform: translate(0,4px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(6px,-10px); } }
  @keyframes mcSprout { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-10deg); } }
  @keyframes mcJump { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-12px) scale(.96,1.05); } }
  @keyframes mcShake { 0%,88%,100% { transform: translateX(0); } 91% { transform: translateX(-2px); } 94% { transform: translateX(2px); } 97% { transform: translateX(-1px); } }
  @keyframes mcPoke { 0% { transform: scale(1); } 40% { transform: scale(1.15,.85); } 100% { transform: scale(1); } }
  /* ปุ่ม + กลางแถบล่าง */
  nav.bottom { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  nav.bottom .fab { color: var(--ink); }
  nav.bottom .fab span { width: 54px; height: 54px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; font-weight: 300; line-height: 1; color: #fff; background: linear-gradient(135deg, #ff7ad9, #8b7cff 55%, #2fd5b5); box-shadow: 0 6px 18px rgba(139,124,255,.45); transition: transform .2s; }
  nav.bottom .fab:active span { transform: scale(.9) rotate(90deg); }
  nav.bottom .fab::before { display: none; }
  .q-sheet h2 { margin: 0; }
  .q-label { margin: 14px 2px 6px; font-size: 12px; letter-spacing: .1em; color: var(--muted); }
  .q-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .q-big { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; min-height: 0; border-radius: 18px; border: 0; background: color-mix(in srgb, var(--g) 18%, var(--card)); color: var(--ink); }
  .q-big span { font-weight: 800; font-size: 15px; } .q-big small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .q-group { margin-top: 10px; }
  .q-gh { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-weight: 700; font-size: 14px; }
  .q-dot { width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--g) 22%, transparent); color: var(--g); }
  .q-dot .ic { width: 18px; height: 18px; }
  .q-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .q-chip { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 14px; }
  .q-chip.on { color: var(--ink); border-color: color-mix(in srgb, var(--g) 55%, var(--line)); background: color-mix(in srgb, var(--g) 10%, var(--card)); }
  dialog.q-sheet[open] { animation: qUp .28s cubic-bezier(.2,.9,.3,1); }
  @keyframes qUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
  /* เมนูข้างแบบกลุ่ม */
  .drawer-list .grp { display: flex; align-items: center; gap: 8px; }
  .drawer-list .grp .gdot { width: 8px; height: 8px; border-radius: 50%; background: var(--g, var(--muted)); }
  /* คลื่นเมื่อแตะ · บีบเบา ๆ */
  .rpl { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: rpl .6s ease-out forwards; pointer-events: none; }
  @keyframes rpl { to { transform: scale(2.4); opacity: 0; } }
  button:active:not(:disabled) { transform: scale(.97); }
  nav.bottom button:active { transform: none; }
  button { transition: transform .12s, background-color .2s, border-color .2s; }
  /* ช่องกรอกเรืองแสง */
  input:focus, select:focus, textarea:focus { outline: none; border-color: #8b7cff !important; box-shadow: 0 0 0 4px rgba(139,124,255,.22), 0 0 18px rgba(255,122,217,.18); }
  input[data-lv="ok"] { border-color: #2fbf8f !important; background: color-mix(in srgb, #2fbf8f 8%, var(--field)); }
  input[data-lv="mid"] { border-color: #f0a030 !important; background: color-mix(in srgb, #f0a030 10%, var(--field)); }
  input[data-lv="hi"] { border-color: #e2453c !important; background: color-mix(in srgb, #e2453c 10%, var(--field)); }
  /* กราฟเส้นวาดตัวเอง */
  .spark .ln { stroke-dasharray: 400; stroke-dashoffset: 0; animation: lnDraw 1.2s ease-out both; }
  .spark .ar { animation: arIn 1.2s ease-out both; }
  @keyframes lnDraw { from { stroke-dashoffset: 400; } to { stroke-dashoffset: 0; } }
  @keyframes arIn { from { opacity: 0; } }
  /* ช่องบันทึกวันนี้ที่จดแล้ว */
  .tile.done { border-color: color-mix(in srgb, #2fbf8f 50%, var(--line)); }
  .tile.done small { color: #1fa98a; }
  /* ฉลองเมื่อบันทึก */
  .cele { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; pointer-events: none; background: rgba(10,8,20,.18); animation: celeBg .3s ease-out; transition: opacity .4s; }
  .cele.out { opacity: 0; }
  .cele-in { position: relative; display: grid; place-items: center; }
  .cele-ok { animation: celeOk .5s cubic-bezier(.3,1.6,.5,1) both; filter: drop-shadow(0 6px 20px rgba(47,213,181,.5)); }
  .cele-ok path { stroke-dasharray: 80; stroke-dashoffset: 80; animation: celeTick .35s .2s ease-out forwards; }
  .cele-m { position: absolute; bottom: -62px; animation: celeOk .5s .15s cubic-bezier(.3,1.6,.5,1) both; }
  .cele i { position: absolute; left: 50%; top: 50%; width: 14px; height: 9px; margin: -4px 0 0 -7px; border-radius: 10px 0; animation: celeLeaf .8s ease-out both; }
  @keyframes celeBg { from { opacity: 0; } }
  @keyframes celeOk { from { transform: scale(.2); opacity: 0; } }
  @keyframes celeTick { to { stroke-dashoffset: 0; } }
  @keyframes celeLeaf { 0% { transform: translate(0,0) rotate(0) scale(.4); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) rotate(200deg) scale(1); opacity: 0; } }
  /* ปิดการเคลื่อนไหว */
  .cv-still .cv-mascot, .cv-still .mc-play, .cv-still .mc-bit, .cv-still .mc-eyes, .cv-still .mc-arm, .cv-still .mc-z, .cv-still .mc-sprout, .cv-still .rg-fg, .cv-still .spark .ln, .cv-still .spark .ar, .cv-still dialog.q-sheet[open] { animation: none !important; }
  .cv-still .cv-vine { display: none; }
  @media (prefers-reduced-motion: reduce) { .cv-mascot, .mc-play, .mc-bit, .mc-eyes, .mc-arm, .rg-fg, .spark .ln { animation: none !important; } }
  @media (max-width: 360px) { .hero-ring { width: 140px; height: 140px; } .hero-ring svg:first-child { width: 140px; height: 140px; } .hero-num b { font-size: 42px; } }

  /* ===== ขั้นเลือก 1-2-3: แต่ละแถวเลือก 1 อย่าง แถวสุดท้ายแตะแล้วบันทึก ===== */
  .pstep { margin-top: 14px; }
  .pstep-h { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 700; font-size: 15px; }
  .pstep-h i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff7ad9, #8b7cff); }
  .pstep-h span { margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 3px 8px; border-radius: 999px; color: #1fa98a; background: color-mix(in srgb, #2fd5b5 14%, transparent); }
  .ipick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ipick button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px; padding: 8px 2px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); }
  .ipick button span { font-size: 24px; line-height: 1.1; }
  .ipick button small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .ipick button[aria-checked="true"] { color: var(--ink); border-color: #ff7ad9; background: color-mix(in srgb, #ff7ad9 12%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, #ff7ad9 18%, transparent); }
  .ipick button[aria-checked="true"] small { font-weight: 700; }
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px; gap: 4px; border-radius: 16px; background: color-mix(in srgb, var(--line) 60%, transparent); }
  .seg button { min-height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 600; }
  .seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
  .gos { display: grid; grid-template-columns: repeat(auto-fit, minmax(58px, 1fr)); gap: 6px; }
  .gos button { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 16px; border: 1.5px dashed color-mix(in srgb, #2fd5b5 60%, var(--line)); background: color-mix(in srgb, #2fd5b5 8%, var(--card)); color: var(--ink); font-size: 18px; font-weight: 800; }
  .gos button small { font-size: 11px; font-weight: 500; color: var(--muted); }
  .gos button.ok { border-style: solid; font-size: 14px; }
  .pstep .sweet-lv { margin-top: 0; }
  /* บันทึกวันนี้แบ่งกลุ่ม */
  .lg-h { display: flex; align-items: center; gap: 6px; margin: 12px 2px 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
  .lg-h:first-child { margin-top: 2px; }
  .lg-h i { width: 8px; height: 8px; border-radius: 50%; background: var(--g); }
  .ipick.multi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ipick button[aria-pressed="true"] { color: var(--ink); border-color: #ff7ad9; background: color-mix(in srgb, #ff7ad9 12%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, #ff7ad9 18%, transparent); }
  .ipick.multi button small { white-space: normal; line-height: 1.25; text-align: center; }
  .pstep-h small { font-weight: 400; font-size: 12px; }
  .r-hab { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
  .r-hab span { font-size: 13px; color: var(--muted); }
  .r-hab .seg button { min-height: 36px; font-size: 13px; padding: 0 2px; }
  .r-preview { margin-top: 14px; padding: 12px; border-radius: 18px; border: 1px dashed color-mix(in srgb, #2fd5b5 55%, var(--line)); background: color-mix(in srgb, #2fd5b5 6%, transparent); }
  .r-preview .chips button[aria-pressed="false"] { opacity: .55; }
  body.kb-open nav.bottom, body.kb-open .cv-vine { display: none; }
  .ic.xs { width: 15px; height: 15px; vertical-align: -2px; }
  i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; vertical-align: 0; }
  i.dot.ok { background: #2fbf8f; } i.dot.mid { background: #f0a030; }
  .who-av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; color: #fff; background: #8b7cff; vertical-align: middle; }
  .who-av .ic { width: 18px; height: 18px; }
  .who-chip .who-av { width: 24px; height: 24px; } .who-chip .who-av .ic { width: 15px; height: 15px; }
  .who-av.r-parent, .who-av.r-grand { background: #ff9f43; } .who-av.r-partner { background: #ff7ad9; } .who-av.r-child { background: #4fb3ff; } .who-av.r-other { background: #2fd5b5; }
  .ipick button span .ic { width: 26px; height: 26px; }
  .ms-emo .ic { color: var(--brand); }
  /* ===== ตัวเลือกแบบกระชับในกรอบ ===== */
  .seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
  .seg.sm button { min-height: 34px; font-size: 13px; }
  .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 14px; padding: 0 4px; }
  .chips.pick { padding: 6px; gap: 6px; border-radius: 18px; border: 1px solid var(--line); background: color-mix(in srgb, var(--line) 25%, transparent); }
  .chips.pick button { min-height: 38px; padding: 4px 12px; font-size: 14px; }
  /* สเกลระดับ: รางยาว จุดเป็นขั้น */
  .scale { position: relative; padding: 26px 6px 4px; }
  .sc-track { position: absolute; left: calc(6px + 100% / var(--n) / 2 - 6px / var(--n)); right: calc(6px + 100% / var(--n) / 2 - 6px / var(--n)); top: 38px; height: 10px; border-radius: 10px; border: 1.5px solid var(--line); background: color-mix(in srgb, var(--line) 35%, transparent); }
  .sc-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px; width: calc(100% * var(--i) / (var(--n) - 1)); background: linear-gradient(90deg, #2fd5b5, #ff9f43 60%, #ff5c8a); transition: width .3s cubic-bezier(.2,.8,.2,1); }
  .sc-stops { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .sc-stops button { position: relative; min-height: 34px; padding: 0; border: 0; background: none; display: grid; place-items: center; }
  .sc-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); transition: transform .2s, border-color .2s; }
  .sc-stops b { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%) scale(.6); opacity: 0; white-space: nowrap; font-size: 13px; padding: 2px 8px; border-radius: 999px; color: #fff; background: #8b7cff; transition: opacity .2s, transform .2s; pointer-events: none; }
  .sc-stops button[aria-checked="true"] .sc-dot { transform: scale(1.35); border-color: #ff7ad9; box-shadow: 0 0 0 4px color-mix(in srgb, #ff7ad9 22%, transparent); }
  .sc-stops button[aria-checked="true"] b { opacity: 1; transform: translateX(-50%) scale(1); }

  /* ===== การ์ดแปลผล ===== */
  .ins { --lv: var(--muted); border-radius: 22px; padding: 14px 14px 10px; margin: 4px 0 12px; border: 1px solid color-mix(in srgb, var(--lv) 40%, var(--line)); background: linear-gradient(160deg, color-mix(in srgb, var(--lv) 14%, var(--card)), var(--card) 70%); }
  .ins.lv-green { --lv: #2fbf8f; } .ins.lv-amber { --lv: #f0a030; } .ins.lv-red { --lv: #e2453c; } .ins.lv-low { --lv: #4fb3ff; } .ins.lv-gray, .ins.lv-none { --lv: #8a86a0; }
  .ins-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .ins-num b { font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
  .ins-num i { font-style: normal; font-size: 14px; color: var(--muted); margin-left: 6px; }
  .ins-num small { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
  .ins-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
  .ins-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #16121c; background: var(--lv); white-space: nowrap; }
  .ins-delta { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
  .ins-delta.good { color: var(--up-ink); background: color-mix(in srgb, #2fbf8f 14%, transparent); }
  .ins-delta.bad { color: var(--down-ink); background: color-mix(in srgb, #f0a030 14%, transparent); }
  .ins-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0 4px; }
  .ins-dots .dt { display: flex; flex-direction: column; align-items: center; gap: 3px; }
  .ins-dots .dt i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
  .ins-dots .dt small { font-size: 11px; color: var(--muted); }
  .dt-green i { background: #2fbf8f; border-color: #2fbf8f !important; } .dt-amber i { background: #f0a030; border-color: #f0a030 !important; }
  .dt-red i { background: #e2453c; border-color: #e2453c !important; } .dt-low i { background: #4fb3ff; border-color: #4fb3ff !important; } .dt-gray i { background: #8a86a0; border-color: #8a86a0 !important; }
  .ins-say { margin: 10px 0 4px; font-size: 15px; line-height: 1.5; color: var(--ink); }
  .ins-more summary { cursor: pointer; font-size: 13px; color: var(--brand); padding: 6px 0; }
  .ins-more dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 6px 0; font-size: 13px; }
  .ins-more dt { color: var(--muted); } .ins-more dd { margin: 0; color: var(--ink); }
  .ins-foot { font-size: 12px; margin: 6px 0 2px; }
  .sl-bars { width: 100%; margin-top: 10px; font-size: 10px; }
  .sl-bars line.g { stroke: var(--line); stroke-dasharray: 2 3; } .sl-bars text { fill: var(--muted); }
  .sl-bars rect.b { fill: #8a86a0; } .sl-bars rect.lv-green { fill: #2fbf8f; } .sl-bars rect.lv-amber { fill: #f0a030; } .sl-bars rect.lv-red { fill: #e2453c; } .sl-bars rect.lv-gray { fill: #8a86a0; }
  .sw-meter { position: relative; height: 12px; margin: 12px 0 2px; border-radius: 12px; background: color-mix(in srgb, var(--line) 50%, transparent); }
  .sw-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 12px; background: linear-gradient(90deg, #2fbf8f, #f0a030 60%, #e2453c); }
  .sw-meter b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .5; }
  .ghost { min-height: 42px; border-radius: 14px; border: 1.5px dashed var(--line); background: transparent; color: var(--ink); }
  .sw-none { width: 100%; margin-top: 10px; } .sw-none[aria-pressed="true"] { border-style: solid; border-color: #2fbf8f; color: #1fa98a; }
  .sw-note { font-size: 12px; margin: 8px 2px 0; }
  .sl-man { margin-top: 10px; } .sl-man summary { font-size: 13px; color: var(--brand); cursor: pointer; }
  .goal-bar { position: relative; height: 22px; margin: 12px 0 2px; border-radius: 12px; background: color-mix(in srgb, var(--line) 50%, transparent); overflow: hidden; }
  .goal-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 12px; background: linear-gradient(90deg, #2fd5b5, #2fbf8f); }
  .goal-bar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 22px; font-weight: 700; color: var(--ink); }
  .lk-card h2 { display: flex; align-items: center; gap: 8px; }
  .lk-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
  .lk-list li { padding: 10px 12px; border-radius: 14px; background: var(--brand-soft, rgba(127,127,127,.08)); }
  .lk-list p { margin: 2px 0 0; }
  .lk-area { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
  .lk-act { font-size: 13.5px; color: var(--muted); }
  .lk-more { margin-top: 8px; } .lk-more summary { cursor: pointer; color: var(--muted); font-size: 14px; }
  .lk-foot { font-size: 12px; margin: 10px 0 0; } .lk-hint { font-size: 13.5px; margin: 8px 0 0; }
  .med-li .med-for { margin-left: auto; margin-right: 8px; font-size: 12.5px; border: 0; cursor: pointer; }
  .lk-wins { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
  .lk-wins li { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 600; background: color-mix(in srgb, #2fd5b5 18%, transparent); }
  .lk-wins small { color: var(--muted); font-weight: 700; }
  .cheer { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: rgba(20, 12, 28, .45); animation: celeBg .25s ease; }
  .cheer.out { opacity: 0; transition: opacity .25s; }
  .cheer-in { position: relative; width: min(340px, 100%); padding: 26px 22px 20px; border-radius: 28px; background: var(--cv-solid, var(--card, #fff)); color: var(--ink); text-align: center; box-shadow: 0 24px 60px rgba(20,12,28,.3); animation: cheerPop .45s cubic-bezier(.3,1.5,.5,1); }
  .cheer-in > i { position: absolute; left: 50%; top: 30%; width: 10px; height: 16px; border-radius: 8px 0; opacity: 0; animation: celeLeaf 1.1s ease-out forwards; }
  .cheer-m { margin: -70px auto 0; width: max-content; animation: mcpJump .8s cubic-bezier(.3,1.6,.5,1) .2s 2; }
  .cheer-k { margin: 4px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--up-ink); }
  .cheer-in h2 { margin: 4px 0 6px; font-size: 21px; line-height: 1.35; }
  .cheer-sub { margin: 0; color: var(--muted); font-size: 14.5px; }
  .cheer-pts { margin: 14px 0; font-size: 26px; font-weight: 800; background: linear-gradient(90deg, #ff7ad9, #2fd5b5); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .cheer-in .primary { width: 100%; }
  @keyframes cheerPop { from { transform: scale(.6) translateY(30px); opacity: 0; } }
  .cv-still .cheer-in, .cv-still .cheer-m { animation: none; }

  /* สรุปสัปดาห์บนหน้าแรก */
  .wk-card .fhead { align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .wk-bar { display: flex; gap: 3px; margin: 2px 0 10px; } .wk-bar i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
  .wk-bar i.lv-green { background: #2fbf8f; } .wk-bar i.lv-amber { background: #f2a33a; } .wk-bar i.lv-red, .wk-bar i.lv-low { background: #e5534b; }
  .wk-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto 10px; grid-template-areas: "ic t m d" "ic s s s"; column-gap: 10px; row-gap: 0; align-items: center; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 10px 2px; min-height: 0; color: var(--ink); font: inherit; }
  .wk-row .ic { grid-area: ic; } .wk-row b { grid-area: t; font-size: 16px; font-weight: 600; } .wk-row .wk-m { grid-area: m; font-size: 14px; color: var(--muted); white-space: nowrap; }
  .wk-row small { grid-area: s; font-size: 13px; color: var(--muted); line-height: 1.35; }
  .wk-dot { grid-area: d; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
  .wk-row.lv-green .wk-dot { background: #2fbf8f; } .wk-row.lv-amber .wk-dot { background: #f2a33a; } .wk-row.lv-red .wk-dot, .wk-row.lv-low .wk-dot { background: #e5534b; }
  .dg-t .dg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--line); vertical-align: middle; }
  .dg-t tr.lv-green .dg-dot { background: #2fbf8f; } .dg-t tr.lv-amber .dg-dot { background: #f2a33a; } .dg-t tr.lv-red .dg-dot, .dg-t tr.lv-low .dg-dot { background: #e5534b; }
  .dg-t td { vertical-align: top; } .dg-t td:nth-child(2), .dg-t td:nth-child(3), .dg-t th { white-space: nowrap; } .dg-t td:nth-child(2) { font-size: 14px; } .dg-t td .muted { font-size: 13px; }
  @media print { .dg-t .dg-dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
  .btn-link { padding: 14px; border-radius: 14px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; background: var(--card); }
  .btn-link.hidden { display: none !important; }

  /* แอปเชลล์: หน้าเว็บไม่เลื่อน ให้ body เลื่อนแทน — iOS 26 วางของ position:fixed (เมนูล่าง หน้าต่าง) ผิดที่เมื่อหน้าเว็บเลื่อน/คีย์บอร์ดปิด */
  @media screen {
    html { height: 100%; overflow: hidden; }
    body { height: 100%; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
  }
  .lk-list li.lk-good { background: color-mix(in srgb, #2fd5b5 16%, transparent); }
  .consent-list { margin: 4px 0 8px; padding-left: 18px; white-space: normal; display: grid; gap: 6px; font-size: 15px; line-height: 1.5; }

/* ความคมชัดตัวอักษร (WCAG AA) · สีเข้มขึ้นในโหมดสว่าง */
:root { --up-ink: #1fa98a; --down-ink: #e0712c; }
@media screen { :root:not([data-theme="dark"]) { --gold: #8e4d3b; --muted: #6a6170; --up-ink: #12795f; --down-ink: #b4500f; --flame: #b84300; } }

  /* ===== ความเรียบร้อยทั้งแอป (ปุ่ม ตัวเลือก ช่องกรอก การซูม) ===== */
  /* iOS ซูมเองเมื่อแตะช่องที่ตัวอักษร < 16px และซูมเมื่อแตะสองครั้ง → ปิดทั้งสองอย่าง (ผู้ใช้ยังถ่างนิ้วซูมได้) */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  html, body, button, a, input, select, textarea, label { touch-action: manipulation; }
  input, select, textarea { font-size: max(16px, 1em); }
  /* ช่องวันที่/เวลา: ตัวปกติ ไม่ห่อบรรทัด สูงเท่าช่องตัวเลข */
  input[type="date"], input[type="time"], input[type="datetime-local"] { font-family: inherit !important; font-size: 17px !important; line-height: 1.2; white-space: nowrap; min-height: 52px; padding-top: 10px; padding-bottom: 10px; }
  .bpin { align-items: end; }
  .bpin input:not([type="date"]):not([type="time"]) { min-height: 52px; }
  /* ปุ่มทั่วไป: บรรทัดไม่ห่างจนดูสูงเกิน */
  button { line-height: 1.25; }
  /* ตัวเลือกแบบชิป: เรียงเป็นตารางกว้างเท่ากัน ข้อความบรรทัดเดียว */
  .chips.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr)); gap: 8px; }
  .chips.pick button { min-width: 0; min-height: 46px; padding: 6px 10px; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chips.pick button small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.simple .chips.pick { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); }
  body.simple .chips.pick button { font-size: 18px; }
  /* ปุ่มสั้นห้ามห่อบรรทัด: แท็บแบ่งส่วน ปุ่มกลับ แท็บกลุ่ม ปุ่มในแถว */
  .seg button, .mtabs button, #top-back, .chips button, .row > button, .act b { white-space: nowrap; }
  .seg button { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .row > button { overflow: hidden; text-overflow: ellipsis; font-size: 15px; padding-left: 8px; padding-right: 8px; }
  #top-back { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  @media (max-width: 370px) { .seg button { font-size: 13.5px; padding-left: 2px; padding-right: 2px; } .seg.four button { font-size: 12.5px; } .mtabs button { padding: 6px 12px; } }
  .gos button { white-space: nowrap; min-width: 0; padding-left: 6px; padding-right: 6px; }

/* ---------- หน้าเข้าสู่ระบบ (ดีไซน์ 2026-11) ---------- */
:root { --rh-sky: #e9e1f6; --rh-sun: #ffd9b8; --rh-cloud: #fbfaf7; --rh-h1: #c9dcc9; --rh-h2: #a9cba9; --rh-h3: #7fb38a; --rh-path: #fbe8d2; --rh-tree: #5c9a6a; --rh-tree2: #6fae7b; --rh-trunk: #9a6a43; }
[data-theme="dark"] { --rh-sky: #1c1733; --rh-sun: #ff7ad9; --rh-cloud: rgba(255,255,255,.10); --rh-h1: #1f3b40; --rh-h2: #1b4a45; --rh-h3: #17594d; --rh-path: #2b2545; --rh-tree: #1f7a66; --rh-tree2: #2a9078; --rh-trunk: #7a5538; }
.rh-sky { fill: var(--rh-sky); } .rh-sun { fill: var(--rh-sun); } .rh-cloud { fill: var(--rh-cloud); }
.rh-h1 { fill: var(--rh-h1); } .rh-h2 { fill: var(--rh-h2); } .rh-h3 { fill: var(--rh-h3); } .rh-path { fill: var(--rh-path); }
.rh-tree { fill: var(--rh-tree); } .rh-tree2 { fill: var(--rh-tree2); } .rh-trunk { fill: var(--rh-trunk); }
dialog.reg.login { padding: 0; overflow: auto; }
.reg .login-step { padding: 0 20px 22px; }
.reg-hero { position: relative; height: 200px; margin: 0 -20px 4px; overflow: hidden; border-radius: 26px 26px 0 0; background: var(--rh-sky); }
.reg-hero .rh-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.reg-mascot { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); width: 100px; }
.reg-mascot svg, .reg-mascot img { width: 100%; height: auto; display: block; }
.reg-bubble { position: absolute; left: calc(50% + 46px); top: 22px; margin: 0; max-width: 150px; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--cv-solid, #fbfaf7); color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.35; box-shadow: 0 8px 20px -12px rgba(0,0,0,.4); }
.reg-brand { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; }
.reg-brand img { width: 30px; height: 30px; } .reg-brand span { font-weight: 800; letter-spacing: .16em; color: var(--brand); font-size: 15px; }
.reg .login-step h2 { font-size: 26px; margin: 2px 0 0; }
.reg-sub { margin: 2px 0 12px; color: var(--muted); font-size: 15px; }
.reg .login-step .reg-guest { display: block; width: 100%; margin-top: 14px; min-height: 44px; font-weight: 700; }
[data-theme="dark"] .gbtn { background: var(--cv-solid, #1a1626); color: var(--ink); }
#cl-code { font-size: 26px; letter-spacing: .5em; text-align: center; font-weight: 700; }
@media (min-width: 860px) {
  dialog.reg.login { width: min(920px, 94vw); max-width: 920px; }
  .reg .login-step:not(.hidden) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 36px; padding: 16px 16px 16px 40px; }
  .reg .login-step > * { grid-column: 1; }
  .reg .login-step > .reg-hero { grid-column: 2; grid-row: 1 / span 30; height: auto; min-height: 560px; margin: 0; border-radius: 22px; }
  .reg .login-step > .reg-brand { margin-top: 36px; }
  .reg-mascot { width: 180px; bottom: 40px; transform: translateX(-40%); }
  .reg-bubble { top: auto; bottom: 290px; left: calc(50% + 20px); font-size: 15px; max-width: 220px; white-space: nowrap; }
  .reg .login-step h2 { font-size: 34px; }
}

/* ---------- โหมดผู้สูงอายุ (body.simple) ---------- */
#elder-home:empty { display: none; }
body.simple #view-home > :not(#elder-home):not(#who-badge):not(#plan-card):not(#home-today):not(p) { display: none !important; }
body.simple #view-home > #home-today:empty { display: none; }
.el-greet { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.el-greet .el-masc { width: 64px; flex: none; } .el-greet .el-masc svg, .el-greet .el-masc img { width: 100%; height: auto; display: block; }
.el-greet > div { flex: 1; min-width: 0; }
.el-greet p { margin: 0; font-size: 20px; color: var(--muted); }
.el-greet h2 { margin: 0; font-size: 32px; line-height: 1.2; }
.el-speak { width: 68px; height: 68px; flex: none; border-radius: 20px; border: 2px solid var(--brand); background: var(--card); color: var(--brand); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 15px; font-weight: 800; padding: 0; }
.el-speak .ic { width: 28px; height: 28px; }
.el-status { display: flex; align-items: center; gap: 16px; background: var(--brand); color: var(--cv-on-brand, #fbfaf7); border-radius: 24px; padding: 16px 20px; margin-bottom: 14px; }
.el-status b { font-size: 46px; line-height: 1; } .el-status span { font-size: 21px; line-height: 1.35; font-weight: 700; }
.el-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.el-tile { min-height: 190px; border: 2px solid transparent; border-radius: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; color: var(--ink); font: inherit; }
.el-tile > svg { width: 76px; height: 76px; }
.el-tile b { font-size: 26px; line-height: 1.2; } .el-tile small { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 4px; color: var(--ink); opacity: .85; }
.el-tile.done { border-color: #1f6a3a; } .el-tile.done small { color: #1f6a3a; opacity: 1; }
.el-tile.t-rose { background: #fde3e0; } .el-tile.t-sage { background: #dff0e4; } .el-tile.t-sky { background: #dfe9f6; } .el-tile.t-butter { background: #fbefc9; } .el-tile.t-lav { background: #ece4f7; }
[data-theme="dark"] .el-tile.t-rose { background: rgba(226,85,90,.18); } [data-theme="dark"] .el-tile.t-sage { background: rgba(79,157,105,.2); } [data-theme="dark"] .el-tile.t-sky { background: rgba(75,134,201,.2); } [data-theme="dark"] .el-tile.t-butter { background: rgba(242,201,76,.16); } [data-theme="dark"] .el-tile.t-lav { background: rgba(160,130,255,.18); }
[data-theme="dark"] .el-tile.done { border-color: #5fd39a; } [data-theme="dark"] .el-tile.done small { color: #7fe0ae; }
.el-sos { margin-top: 14px; min-height: 64px; border-radius: 20px; border: 2px solid #c0392b; color: #a12a1e; background: var(--card); display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 800; text-decoration: none; }
[data-theme="dark"] .el-sos { color: #ff8f84; border-color: #ff8f84; }
.el-hint { margin: 0 0 8px; font-size: 20px; font-weight: 600; }
.el-step { background: var(--card); border: 2px solid var(--line, rgba(0,0,0,.08)); border-radius: 22px; padding: 12px 14px; margin-bottom: 12px; }
.el-step label { display: block; font-size: 22px; font-weight: 800; color: var(--ink); margin: 0 0 6px; }
.el-step-row { display: flex; align-items: center; gap: 10px; }
.el-pm { width: 72px; height: 72px; flex: none; border-radius: 22px; border: 0; background: var(--cv-lav, #f1ebf0); color: var(--ink); font-size: 40px; font-weight: 800; line-height: 1; padding: 0; }
.el-step-row input { flex: 1; min-width: 0; text-align: center; font-size: 56px !important; font-weight: 800; height: 76px; border: 0; background: transparent; color: var(--ink); }
.el-more { margin: 4px 0 8px; font-size: 19px; } .el-more summary { min-height: 48px; display: flex; align-items: center; font-weight: 700; color: var(--brand); }
.el-more input { width: 100%; font-size: 28px; height: 60px; }
.el-save { width: 100%; min-height: 76px; font-size: 26px !important; font-weight: 800; border-radius: 24px; }
body.simple #view-menu > .card:not(#menu-input), body.simple #menu-tabs, body.simple #view-menu .mh-hint { display: none !important; }
dialog.el-res { width: min(420px, 94vw); border-radius: 30px; padding: 24px 20px 20px; text-align: center; }
.el-res .elr-k { margin: 0; font-size: 22px; font-weight: 600; color: var(--muted); }
.el-res .elr-val { margin: 4px 0 0; font-size: 72px; font-weight: 800; line-height: 1; }
.el-res .elr-masc { width: 120px; margin: 8px auto; } .el-res .elr-masc svg, .el-res .elr-masc img { width: 100%; height: auto; display: block; }
.el-res .elr-card { border-radius: 24px; padding: 18px; color: #fff; }
.el-res.lv-ok .elr-card { background: #1f6a3a; } .el-res.lv-high .elr-card { background: #8a4a00; } .el-res.lv-low .elr-card { background: #4e3f86; }
.el-res .elr-title { margin: 0; font-size: 34px; font-weight: 800; } .el-res .elr-say { margin: 6px 0 0; font-size: 21px; line-height: 1.45; font-weight: 600; }
.el-res .elr-speak { width: 100%; min-height: 60px; margin-top: 14px; font-size: 21px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.el-res .elr-ok { width: 100%; min-height: 70px; margin-top: 10px; font-size: 24px; font-weight: 800; border-radius: 22px; }
/* บันทึกปัสสาวะในโหมดผู้สูงอายุ: ปุ่มใหญ่ขึ้น */
body.simple [data-bdq-group] button { min-height: 60px; font-size: 20px; font-weight: 700; }
body.simple .bdq-leak { font-size: 20px; min-height: 56px; display: flex; align-items: center; gap: 10px; }
body.simple [data-bdq="save"] { min-height: 72px; font-size: 24px; font-weight: 800; }
.el-pm { font-size: 40px !important; }
[data-theme="dark"] .el-status { color: #160b1c; }
/* ลองทำ 7 วัน */
.tr-go { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); background: transparent; color: var(--brand); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.tr-box { margin: 4px 0 12px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--brand) 9%, transparent); }
.tr-box.tr-good { background: color-mix(in srgb, #2fd5b5 18%, transparent); }
.tr-box > b { display: block; font-size: 16.5px; margin: 2px 0 8px; }
.tr-box p { margin: 6px 0 0; font-size: 15px; line-height: 1.5; }
.tr-btns .link { color: var(--muted); }
.tr-dots { display: flex; gap: 6px; }
.tr-dots i { flex: 1; height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--line) 70%, transparent); }
.tr-dots i.ok { background: #2fbf8f; } .tr-dots i.no { background: color-mix(in srgb, #f0a35c 70%, transparent); }
.tr-dots i.now { outline: 2px solid var(--brand); outline-offset: 1px; }
.tr-how summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-top: 6px; }
.tr-btns { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.tr-btns button { white-space: nowrap; }
.tr-list { display: grid; gap: 8px; margin-top: 8px; }
.tr-list button { text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.tr-list b { display: block; font-size: 15px; } .tr-list small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
/* ปุ่มเปิด/ปิดโหมดผู้สูงอายุ บนแถบด้านบน */
.top-elder { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--brand); background: transparent; color: var(--brand); font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; }
.top-elder .ic { width: 20px; height: 20px; }
.top-elder[aria-pressed="true"] { background: var(--brand); color: var(--cv-on-brand, #fbfaf7); }
[data-theme="dark"] .top-elder[aria-pressed="true"] { color: #160b1c; }
.top-elder ~ .cv-prefs { margin-left: 6px !important; }
body.simple .top-elder { font-size: 16px; min-height: 48px; padding: 0 14px; }
@media (max-width: 360px) { .top-elder span { display: none; } .top-elder { padding: 0 10px; } }
.top > .menu-btn, .top > .wm { flex: none; }
.reg .login-step .cl-forgot { display: block; margin: 8px 0 0 auto; font-size: 14px; min-height: 40px; }
.cl-h { margin: 6px 0 4px; font-size: 20px; }
.cl-rule { font-size: 13px; margin: 4px 0 0; }
.cl-sent-p { margin: 6px 0 4px; line-height: 1.6; }
#cl-forgot .primary, #cl-newpw .primary { width: 100%; min-height: 54px; margin-top: 14px; }
#cl-sent .ghost { width: 100%; min-height: 48px; margin-top: 12px; }
#cl-forgot .link, #cl-sent .link { display: block; margin-top: 10px; min-height: 44px; }

/* มาสคอตรูปชุดใหม่ · ใบเริ่มเหี่ยวตามความสม่ำเสมอในการจด */
img.cv-mascot { height: auto; max-width: 100%; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 6px 14px rgba(43,29,46,.14)); }
img.cv-mascot.mc-c3 { filter: saturate(.75) drop-shadow(0 6px 14px rgba(43,29,46,.14)); }
img.cv-mascot.mc-c4 { filter: saturate(.5) sepia(.25) drop-shadow(0 6px 14px rgba(43,29,46,.14)); }
img.cv-mascot.mc-t-sleep { filter: brightness(.92) saturate(.85) drop-shadow(0 6px 14px rgba(43,29,46,.14)); }

/* ---------- อาหาร: ภาพ + เอฟเฟกต์ ---------- */
.fd-kc { margin: 10px 0 4px; padding: 12px 14px; border-radius: 18px; background: color-mix(in srgb, var(--brand) 8%, transparent); }
.fd-kc b { font-size: 26px; color: var(--brand); } .fd-kc > small { display: block; font-size: 12px; margin-top: 4px; }
.fds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr)); gap: 10px; margin-top: 10px; }
.fd { position: relative; }
.fd-add { width: 100%; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 12px 12px; border-radius: 20px; border: 1.5px solid var(--line, rgba(0,0,0,.12)); background: var(--card, #fff); color: var(--ink); font: inherit; cursor: pointer; touch-action: manipulation; transition: transform .12s; }
.fd-add:active { transform: scale(.96); }
.fd-art { display: block; width: 100%; height: 88px; margin-bottom: 2px; }
.fd-art .fa { width: 100%; height: 100%; overflow: visible; }
.fd-add > b { font-size: 15px; line-height: 1.3; padding-right: 30px; }
.fd-v em { font-style: normal; font-size: 24px; font-weight: 700; color: var(--brand); } .fd-v small { color: var(--muted); font-size: 13px; }
.fd-k { color: var(--muted); font-size: 12px; }
.fd.over .fd-v em { color: var(--warn, #c46a2a); }
.fd-sub { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink); font-size: 18px; }
.fd-sub:disabled { opacity: .35; }
.fd-pop .fa-last { transform-box: fill-box; transform-origin: 50% 100%; animation: fdPop .5s cubic-bezier(.3,1.7,.5,1); }
@keyframes fdPop { 0% { transform: translateY(-14px) scale(.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.fd-tip { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }
.fd-salt { margin-top: 12px; padding: 12px; }
.fd-conds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.fd-conds button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 0; padding: 8px 4px; border-radius: 16px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink); font: inherit; cursor: pointer; touch-action: manipulation; }
.fd-conds button:active { transform: scale(.94); }
.fd-conds span { width: 46px; height: 50px; } .fd-conds .fa { width: 100%; height: 100%; }
.fd-conds small { font-size: 13px; white-space: nowrap; }
.fd-prev { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; border-radius: 18px; background: color-mix(in srgb, var(--brand) 8%, transparent); }
.fd-prev .fa { width: 104px; height: 72px; flex: none; }
.fd-prev div { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .fd-prev b { font-size: 15px; } .fd-prev span { font-size: 13px; color: var(--muted); }
.fa-cup .fa-bub { animation: faBub 2.4s ease-in infinite; } .fa-cup .fa-bub:nth-of-type(2n) { animation-delay: .8s; }
@keyframes faBub { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: .8; } 100% { transform: translateY(-18px); opacity: 0; } }
/* เอฟเฟกต์ลอย */
.ffx { position: fixed; z-index: 95; width: 0; height: 0; pointer-events: none; }
.ffx > i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; opacity: 0; box-shadow: 0 0 0 1px rgba(43,29,46,.08); animation: ffxBit .8s ease-out var(--d) forwards; }
.ffx-grain > i { width: 4px; height: 7px; border-radius: 3px; }
.ffx-leaf > i { width: 10px; height: 6px; border-radius: 10px 0; }
.ffx-drop > i { width: 6px; height: 9px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.ffx-cube > i { width: 7px; height: 7px; border-radius: 2px; }
.ffx-bubble > i { background: transparent !important; border: 2px solid #ffd57a; }
.ffx > b { position: absolute; left: 0; top: -10px; transform: translate(-50%, 0); white-space: nowrap; padding: 5px 11px; border-radius: 14px; background: var(--cv-solid, var(--card, #fff)); color: var(--ink); font-size: 13px; font-weight: 700; box-shadow: 0 6px 18px rgba(43,29,46,.18); animation: ffxLbl 1.2s ease forwards; }
.ffx-has > b { top: 34px; }
.ffx-art { position: absolute; left: -32px; top: -80px; width: 64px; height: 70px; transform-origin: 50% 20%; animation: ffxShake .9s ease-in-out forwards; }
.ffx-art .fa { width: 100%; height: 100%; }
.ffx-drop .ffx-art { animation-name: ffxPour; } .ffx-bubble .ffx-art { animation-name: ffxClink; }
@keyframes ffxBit { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1); } }
@keyframes ffxLbl { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -22px); } }
@keyframes ffxShake { 0% { opacity: 0; transform: translateY(10px) rotate(0); } 15% { opacity: 1; transform: translateY(0) rotate(160deg); } 30% { transform: translateY(-6px) rotate(150deg); } 45% { transform: translateY(2px) rotate(170deg); } 60% { transform: translateY(-6px) rotate(150deg); } 75% { transform: translateY(2px) rotate(170deg); } 100% { opacity: 0; transform: translateY(-8px) rotate(160deg); } }
@keyframes ffxPour { 0% { opacity: 0; transform: rotate(0); } 20% { opacity: 1; transform: rotate(125deg); } 70% { opacity: 1; transform: rotate(135deg); } 100% { opacity: 0; transform: rotate(120deg) translateY(-6px); } }
@keyframes ffxClink { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; transform: scale(1.05) rotate(-12deg); } 45% { transform: rotate(10deg); } 65% { transform: rotate(-6deg); } 100% { opacity: 0; transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .ffx > i, .ffx-art, .fd-pop .fa-last, .fa-cup .fa-bub { animation: none !important; } .ffx-art { opacity: 0; } }
.cv-still .ffx > i, .cv-still .ffx-art, .cv-still .fd-pop .fa-last, .cv-still .fa-bub { animation: none !important; }

/* ---------- โหมดเลิกบุหรี่ ---------- */
:root { --q-teal: #0f5a50; --q-mint: #2fbf9a; --q-gold: #c98a1e; --q-soft: #e9f5f0; }
[data-theme="dark"] { --q-teal: #2ef2d0; --q-mint: #2ef2d0; --q-gold: #ffd27a; --q-soft: rgba(46,242,208,.08); }
.qic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.q-entry, .q-home { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; margin: 0 0 12px; border-radius: 20px; border: 1.5px solid var(--q-mint); background: var(--q-soft); color: var(--ink); font: inherit; min-height: 64px; }
.q-entry .ic, .q-home .qic { width: 30px; height: 30px; color: var(--q-teal); }
.q-entry span, .q-home span { flex: 1; display: flex; flex-direction: column; } .q-entry small, .q-home small { color: var(--muted); font-size: 13px; }
.q-home-go, .q-entry > span:last-child { flex: none !important; font-size: 26px; color: var(--q-teal); }
#quit-home:empty { display: none; } #quit-home .q-home { margin: 0 0 14px; }
.q-hero { position: relative; border-radius: 28px; padding: 22px 18px 18px; background: var(--card); box-shadow: 0 18px 40px -28px rgba(15,90,80,.6); text-align: center; overflow: hidden; margin-bottom: 14px; }
.q-hero::before { content: ""; position: absolute; inset: auto -40px -60px -40px; height: 140px; background: var(--q-soft); border-radius: 50% 50% 0 0; }
.q-ring-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto; }
.q-ring { width: 220px; height: 220px; transform: rotate(-90deg); }
.q-ring-bg { fill: none; stroke: var(--line, rgba(0,0,0,.08)); stroke-width: 14; }
.q-ring-fg { fill: none; stroke: var(--q-mint); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.2,.8,.2,1); filter: drop-shadow(0 0 6px rgba(47,191,154,.45)); }
.q-ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.q-days { font-size: 64px; line-height: 1; font-weight: 800; color: var(--q-teal); animation: qPop .7s cubic-bezier(.3,1.6,.5,1) both; }
.q-ring-in span { font-size: 15px; font-weight: 700; color: var(--muted); }
.q-clock { margin-top: 4px; font: 700 20px/1.2 ui-monospace, Menlo, Consolas, monospace !important; color: var(--ink) !important; letter-spacing: .04em; }
.q-masc { position: absolute; right: -14px; bottom: -6px; width: 64px; animation: qFloat 3.2s ease-in-out infinite; }
.q-masc svg { width: 100%; height: auto; display: block; }
.q-next { position: relative; margin: 12px 0 0; font-weight: 700; color: var(--ink); }
.q-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.q-stat { border-radius: 20px; padding: 14px 8px; text-align: center; background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 4px; animation: qRise .6s ease-out both; }
.q-stat:nth-child(2) { animation-delay: .08s; } .q-stat:nth-child(3) { animation-delay: .16s; }
.q-stat .qic { width: 28px; height: 28px; }
.q-stat.t-money .qic { color: var(--q-gold); } .q-stat.t-cig .qic { color: #e2555a; } .q-stat.t-fist .qic { color: #7d68b8; }
[data-theme="dark"] .q-stat.t-cig .qic { color: #ff8f84; } [data-theme="dark"] .q-stat.t-fist .qic { color: #c5b3ff; }
.q-stat b { font-size: 22px; line-height: 1.2; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.q-stat small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.q-sos { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; border: 0; border-radius: 24px; padding: 18px 20px; margin-bottom: 14px; background: #c2410c; color: #fff; font: inherit; min-height: 76px; overflow: visible; }
.q-sos .qic { width: 34px; height: 34px; } .q-sos span:last-child { display: flex; flex-direction: column; } .q-sos b { font-size: 20px; } .q-sos small { font-size: 13px; opacity: .92; }
.q-sos-ring { position: absolute; inset: 0; border-radius: 24px; border: 3px solid #c2410c; animation: qPulse 2.2s ease-out infinite; pointer-events: none; }
[data-theme="dark"] .q-sos { background: #ff8a4c; color: #1a0d05; } [data-theme="dark"] .q-sos-ring { border-color: #ff8a4c; }
.q-tl h3, .q-tr h3 { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.q-tl ol { list-style: none; margin: 0; padding: 0; position: relative; }
.q-tl ol::before { content: ""; position: absolute; left: 19px; top: 8px; bottom: 8px; width: 2px; background: var(--line, rgba(0,0,0,.1)); }
.q-tl li { position: relative; display: flex; gap: 12px; padding: 0 0 16px; animation: qRise .5s ease-out both; animation-delay: calc(var(--i) * .07s); }
.q-node { position: relative; z-index: 1; width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--line, rgba(0,0,0,.12)); color: var(--muted); }
.q-node .qic { width: 20px; height: 20px; }
.q-tl li.done .q-node { background: var(--q-mint); border-color: var(--q-mint); color: #fff; animation: qPop .6s cubic-bezier(.3,1.6,.5,1) both; animation-delay: calc(var(--i) * .07s + .2s); }
[data-theme="dark"] .q-tl li.done .q-node { color: #0b1a17; }
.q-tl li.now .q-node { border-color: var(--q-mint); color: var(--q-teal); box-shadow: 0 0 0 6px var(--q-soft); }
.q-tl li b { font-size: 16px; } .q-tl li p { margin: 2px 0 6px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.q-tl li:not(.done):not(.now) p, .q-tl li:not(.done):not(.now) b { color: var(--muted); }
.q-bar, .q-tr-bar { display: block; height: 8px; border-radius: 99px; background: var(--line, rgba(0,0,0,.08)); overflow: hidden; }
.q-bar i, .q-tr-bar i { display: block; height: 100%; border-radius: 99px; background: var(--q-mint); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.q-src { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; } .q-src a { color: inherit; }
.q-tr-row { display: grid; grid-template-columns: 96px 1fr 28px; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.q-tr-row b { text-align: right; } .q-tr-bar { height: 12px; } .q-tr-bar i { background: #f08a4b; }
.q-tip { font-size: 13px; margin: 6px 0 0; }
.q-call { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--card); color: var(--ink); text-decoration: none; margin: 14px 0 8px; border: 1.5px solid var(--line, rgba(0,0,0,.08)); min-height: 64px; }
.q-call .qic { color: var(--q-teal); width: 28px; height: 28px; } .q-call span { display: flex; flex-direction: column; } .q-call small { color: var(--muted); font-size: 13px; }
.q-foot { text-align: center; font-size: 14px; color: var(--muted); }
.q-slip { border-radius: 20px; padding: 14px 16px; background: #fff3e6; color: #4a2a0c; margin-bottom: 14px; border: 1.5px solid #f2b37a; }
[data-theme="dark"] .q-slip { background: rgba(255,138,76,.12); color: var(--ink); border-color: rgba(255,138,76,.5); }
.q-slip p { margin: 0 0 10px; line-height: 1.55; } .q-slip-b { display: flex; gap: 8px; } .q-slip-b button { flex: 1; min-height: 46px; }
.q-intro h2 { position: relative; margin: 6px 0 4px; } .q-intro p { position: relative; margin: 0; color: var(--muted); }
.q-intro-art { position: relative; width: 200px; margin: 0 auto; }
.q-intro-art svg { width: 200px; height: 140px; display: block; }
.q-cig { fill: #f6f1ea; stroke: #c9bdb0; stroke-width: 2; } .q-filter { fill: #e3a066; }
.q-smoke { fill: none; stroke: #b9b1c2; stroke-width: 4; stroke-linecap: round; opacity: .7; animation: qSmoke 2.6s ease-in-out infinite; }
.q-smoke.s2 { animation-delay: .9s; }
.q-slash { stroke: #e2555a; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 160; stroke-dashoffset: 160; animation: qDraw .9s .4s ease-out forwards; }
.q-form label { display: block; margin-top: 10px; font-weight: 700; }
.q-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-go { width: 100%; min-height: 56px; margin-top: 16px; font-size: 18px; }
dialog.q-sos-dlg { width: min(440px, 94vw); border-radius: 30px; padding: 20px 18px 14px; text-align: center; }
.q-sos-dlg h2 { font-size: 21px; margin: 4px 0 12px; }
.qs-breath { position: relative; width: 180px; height: 180px; margin: 0 auto; display: grid; place-items: center; }
.qs-ball { position: absolute; width: 132px; height: 132px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #bff3e3, #2fbf9a 70%); animation: qBreath 10s ease-in-out infinite; box-shadow: 0 10px 30px -10px rgba(47,191,154,.7); }
.qs-timer { position: absolute; inset: 0; width: 180px; height: 180px; transform: rotate(-90deg); }
.qs-t-bg { fill: none; stroke: var(--line, rgba(0,0,0,.08)); stroke-width: 6; } .qs-t-fg { fill: none; stroke: #c2410c; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.qs-left { position: relative; font: 800 30px/1 ui-monospace, Menlo, Consolas, monospace; color: #0b3a33; }
.qs-say { font-size: 20px; font-weight: 800; margin: 10px 0 8px; color: var(--q-teal); min-height: 28px; }
.qs-tips { list-style: none; padding: 0; margin: 0 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; }
.qs-tips li { font-size: 13px; line-height: 1.45; background: var(--q-soft); border-radius: 14px; padding: 8px 10px; } .qs-tips b { display: block; font-size: 14px; }
.qs-k { margin: 6px 0; font-weight: 700; font-size: 14px; }
.qs-trig { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 12px; }
.qs-trig button { min-height: 40px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--line, rgba(0,0,0,.12)); background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.qs-trig button[aria-pressed="true"] { background: var(--q-teal); border-color: var(--q-teal); color: #fff; }
[data-theme="dark"] .qs-trig button[aria-pressed="true"] { color: #0b1a17; }
.qs-ok { width: 100%; min-height: 56px; font-size: 18px; }
.qs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.qs-row > * { min-height: 48px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.qs-close { margin-top: 8px; min-height: 44px; width: 100%; }
.qs-done-m { width: 120px; margin: 10px auto; animation: qPop .7s cubic-bezier(.3,1.6,.5,1) both; } .qs-done-m svg { width: 100%; height: auto; display: block; }
@keyframes qPop { from { transform: scale(.4); opacity: 0; } }
@keyframes qRise { from { transform: translateY(14px); opacity: 0; } }
@keyframes qFloat { 50% { transform: translateY(-6px); } }
@keyframes qPulse { from { transform: scale(1); opacity: .7; } to { transform: scale(1.08, 1.25); opacity: 0; } }
@keyframes qBreath { 0% { transform: scale(.62); } 40% { transform: scale(1); } 100% { transform: scale(.62); } }
@keyframes qSmoke { 0% { transform: translateY(6px); opacity: 0; } 40% { opacity: .7; } 100% { transform: translateY(-14px); opacity: 0; } }
@keyframes qDraw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .q-days, .q-stat, .q-tl li, .q-tl li.done .q-node, .q-masc, .q-sos-ring, .qs-ball, .q-smoke, .qs-done-m { animation: none !important; }
  .q-slash { animation: none; stroke-dashoffset: 0; } .q-ring-fg, .q-bar i, .q-tr-bar i { transition: none; }
}
.fa-over image { filter: hue-rotate(-30deg) saturate(2.2) brightness(1.02); }

/* ---------- ประจำเดือน: ผ้าอนามัยแบบภาพ ---------- */
.pads.pd2 { gap: 10px; }
.pdw { position: relative; }
.pd2 .pad { width: 100%; min-height: 0; padding: 12px 6px 10px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; touch-action: manipulation; transition: transform .12s, border-color .2s, background .2s; }
.pd2 .pad:active { transform: scale(.95); }
.pdw.on .pad { border-color: color-mix(in srgb, #e0405c 45%, transparent); background: color-mix(in srgb, #e0405c 7%, var(--card, #fff)); }
.pd2 .pd-art { width: 58px; height: 88px; display: block; }
.pd2 .pd-art svg { width: 100%; height: 100%; margin: 0; overflow: visible; }
.pd2 .pad small { font-size: 13px; color: var(--ink); font-weight: 600; line-height: 1.25; text-align: center; }
.pd2 .pad em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pd2 .pad .n { top: 8px; right: 8px; background: #e0405c; }
.pd2 .pad .n.z { background: transparent; }
.pd-sub { position: absolute; top: 8px; left: 8px; width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--card, #fff); color: var(--ink); font-size: 17px; line-height: 1; }
.pdw.pd-pop .pd-art svg { transform-origin: 50% 90%; animation: pdSquish .45s cubic-bezier(.3,1.6,.5,1); }
.pdw.pd-pop .pd-blood { transform-box: fill-box; transform-origin: 50% 0; animation: pdSpread .6s ease-out; }
@keyframes pdSquish { 0% { transform: scale(1.08, .9); } 60% { transform: scale(.97, 1.04); } 100% { transform: none; } }
@keyframes pdSpread { 0% { transform: scale(.4); opacity: .4; } 100% { transform: none; opacity: 1; } }
.pc2 { display: flex; align-items: center; gap: 10px; }
.pc2 .pc-ic { width: 40px; height: 40px; flex: none; } .pc2 .pc-ic svg { width: 100%; height: 100%; }
.pc2 .pc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; text-align: left; } .pc2 .pc-t b { font-size: 15px; } .pc2 .pc-t small { font-size: 12.5px; color: var(--muted); }
.ps2 { flex-wrap: wrap; } .ps2 .ps-bar { flex-basis: 100%; height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; margin-top: 6px; display: block; }
.ps2 .ps-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ff9db0, #e0405c); transition: width .4s; }
@media (prefers-reduced-motion: reduce) { .pdw.pd-pop .pd-art svg, .pdw.pd-pop .pd-blood { animation: none; } }

/* ---------- เปิดในเบราว์เซอร์ของแอป (LINE, Facebook, IG) ---------- */
.cl-iab { margin: 4px 0 12px; padding: 14px; border-radius: 16px; text-align: left;
  background: color-mix(in srgb, #e0a020 14%, var(--card, #fff)); border: 1.5px solid color-mix(in srgb, #e0a020 45%, transparent); }
.cl-iab b { display: block; font-size: 16px; }
.cl-iab p { margin: 4px 0 10px; font-size: 14px; color: var(--ink); }
.cl-iab .cl-iab-how { font-weight: 600; }
.cl-iab button { width: 100%; }
.cl-iab small { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; text-align: center; }
.cl-iab.pulse { animation: iabPulse .7s ease 2; }
.gbtn.gbtn-off { opacity: .45; }
@keyframes iabPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #e0a020 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .cl-iab.pulse { animation: none; } }
/* ---------- แผนจดจากแพทย์: นับถอยหลัง วิธีจด เตือนในปฏิทิน ---------- */
.rxp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rxp-ap { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--ink); }
.rxp-ap .ic { width: 15px; height: 15px; }
.rxp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rxp-st { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.rxp-st.ok { background: color-mix(in srgb, #2fa67a 16%, transparent); color: #1f8a63; }
.rxp-st.due { background: color-mix(in srgb, #e0a020 18%, transparent); color: #a8700a; }
:root[data-theme="dark"] .rxp-st.ok { color: #6fe0b4; } :root[data-theme="dark"] .rxp-st.due { color: #f3c560; }
.rxp-act { display: flex; gap: 8px; flex-wrap: wrap; }
.rxp-act .ic, #plan-cal .ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.rxp-when { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: color-mix(in srgb, var(--gold) 12%, transparent); }
.rxp-when .ic { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.rh-steps { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 10px; counter-reset: rh; }
.rh-steps li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: color-mix(in srgb, var(--line) 35%, transparent);
  counter-increment: rh; position: relative; animation: rhIn .35s ease both; animation-delay: calc(var(--i) * 60ms); }
.rh-steps li::before { content: counter(rh); position: absolute; top: 6px; left: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
.rh-steps li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rh-steps li b { font-size: 15px; } .rh-steps li small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.rh-art { width: 54px; height: 54px; flex: none; padding: 6px; border-radius: 14px; background: var(--panel, var(--card));
  fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
body.simple .rh-steps li b { font-size: 18px; } body.simple .rh-art { width: 64px; height: 64px; }
.draft-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: color-mix(in srgb, #e0a020 22%, transparent); }
@keyframes rhIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rh-steps li { animation: none; } }
.plan .rxp-act { align-items: stretch; flex-wrap: nowrap; }
.plan .rxp-act button { width: auto; margin: 0; white-space: nowrap; }
.plan .rxp-act button.primary { flex: 1; }
.plan .rxp-act button:not(.primary) { flex: none; }

/* ---------- การแจ้งเตือน (push) ---------- */
#push-card .ic { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.push-kinds { display: grid; gap: 8px; margin: 6px 0 10px; }
.push-k { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--line) 35%, transparent); cursor: pointer; }
.push-k input { width: 22px; height: 22px; flex: none; accent-color: var(--gold, #c9a14a); }
.push-k span { display: flex; flex-direction: column; gap: 2px; }
.push-k small { color: var(--muted); font-size: 13px; }
.push-steps { margin: 6px 0 0; padding-left: 22px; line-height: 1.7; }
body.simple .push-k b { font-size: 18px; }
/* ---------- ทัวร์แอป ---------- */
.tour { position: fixed; inset: 0; z-index: 300; }
.tour-hole { position: fixed; border-radius: 22px; box-shadow: 0 0 0 200vmax rgba(18,10,24,.66); transition: left .35s ease, top .35s ease, width .35s ease, height .35s ease, border-radius .35s; pointer-events: none; }
.tour-hole::after { content: ""; position: absolute; inset: -4px; border-radius: inherit; border: 2px solid var(--brand); animation: tourRing 1.6s ease-out infinite; }
@keyframes tourRing { 0% { opacity: .9; transform: scale(.98); } 100% { opacity: 0; transform: scale(1.08); } }
.tour-card { position: fixed; width: min(320px, calc(100vw - 24px)); padding: 16px 16px 12px; border-radius: 22px; background: var(--cv-solid, var(--card, #fff)); color: var(--ink); box-shadow: 0 18px 50px rgba(18,10,24,.35); transition: left .35s ease, top .35s ease; outline: none; }
.tour-in .tour-card { animation: tourIn .32s cubic-bezier(.2,1.2,.4,1); }
.tour-out { opacity: 0; transition: opacity .2s; }
@keyframes tourIn { 0% { opacity: 0; transform: translateY(8px) scale(.97); } 100% { opacity: 1; transform: none; } }
.tour-dots { display: flex; gap: 5px; margin-bottom: 10px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 35%, transparent); transition: width .25s, background .25s; }
.tour-dots i.past { background: color-mix(in srgb, var(--brand) 45%, transparent); } .tour-dots i.on { width: 20px; background: var(--brand); }
.tour-t { display: block; font-size: 18px; margin-bottom: 4px; }
.tour-p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); opacity: .85; }
.tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-btns button { min-height: 44px; padding: 0 16px; border-radius: 14px; font: inherit; font-size: 15px; white-space: nowrap; cursor: pointer; border: 0; }
.tour-skip { background: transparent; color: var(--muted); margin-right: auto; padding-left: 4px !important; }
.tour-back { background: transparent; color: var(--ink); border: 1px solid var(--line) !important; }
.tour-next { background: linear-gradient(135deg, #ff8fd8, #a98bff); color: #1c1022; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } .tour-hole::after, .tour-in .tour-card { animation: none; } }

.hero-rhythm { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; line-height: 1.35; }
.hero-rhythm.ok { color: #2fbf8f; }

/* ครอบครัวดูแลกัน */
.fw-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--field); color: var(--ink); font: inherit; }
.fw-row b { flex: 0 0 auto; }
.fw-row span { flex: 1; color: var(--muted); font-size: 14px; }
.fw-row i { font-style: normal; color: var(--muted); }
.fw-row.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.fw-row.warn span { color: var(--warn-ink); }
.sh-sec { padding: 12px 0; border-top: 1px solid var(--line); }
.sh-sec:first-child { border-top: 0; }
.sh-sec h3 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.sh-sec .row { display: flex; gap: 8px; margin: 8px 0; }
.sh-sec .row input { flex: 1; }
.sh-lbl { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
.sh-lbl input { margin-top: 4px; }
.sh-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.sh-open { flex: 1; display: flex; justify-content: space-between; background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-align: left; }
.sh-open small { color: var(--muted); }
.sh-code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 2px; }
.sh-code.big { display: block; font-size: 30px; text-align: center; margin: 8px 0 12px; color: var(--brand); }
.sh-made { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--ok-soft); }
.sh-made p { margin: 0; text-align: center; font-size: 14px; }
.sh-bk { margin: 8px 0 2px; font-size: 20px; }
.sh-alerts { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.sh-alerts p { margin: 4px 0; display: flex; gap: 6px; align-items: flex-start; }
.sh-ok { margin: 10px 0; color: var(--ok-ink); display: flex; gap: 6px; align-items: center; }
.sh-lines { margin-top: 6px; }
.sh-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sh-line span small { display: block; color: var(--muted); font-size: 12.5px; }
.sh-line b { font-size: 18px; }
.sh-line.ok b { color: var(--ok-ink); }
.sh-line.warn b { color: var(--warn); }
.sh-line.bad b { color: var(--danger); }
.link.danger { color: var(--danger); }
.sh-sec .row { grid-template-columns: minmax(0, 1fr) auto; }
.sh-sec .row > button.primary { width: auto; padding: 12px 20px; }

/* โปรแกรมใจสงบ */
.pg-card { padding: 14px; margin-bottom: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--field); }
.pg-card p { margin: 6px 0; font-size: 14.5px; }
.pg-card > b, .pg-off b { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.pg-card .primary { margin-top: 10px; }
.pg-card .link { display: block; margin: 8px auto 0; color: var(--muted); font-size: 13.5px; }
.pg-top { display: flex; justify-content: space-between; align-items: baseline; }
.pg-top span { color: var(--muted); font-size: 13.5px; }
.pg-dots { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.pg-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.pg-dots i.on { background: var(--ok); }
.pg-dots i.miss { background: transparent; border: 1.5px solid var(--line); }
.pg-done { color: var(--ok-ink); display: flex; align-items: center; gap: 6px; }
.pg-rate .chips { flex-wrap: wrap; }
.pg-rate .chips button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pg-cue { text-align: center; font-size: 17px; line-height: 1.5; min-height: 52px; margin: 0 8px 12px; color: var(--ink); }
/* วงกลมหายใจ: เข้า 4 วิ ออก 6 วิ */
.breath { position: relative; width: 170px; height: 170px; margin: 6px auto 4px; display: grid; place-items: center; }
.breath i { position: absolute; inset: 22px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--ok-soft), var(--ok-line)); border: 2px solid var(--ok-line); transform: scale(.72); }
.breath.on i { animation: cv-breath 10s ease-in-out infinite; }
.breath span { position: relative; font-weight: 600; color: var(--ok-ink); }
@keyframes cv-breath { 0% { transform: scale(.72); } 40% { transform: scale(1.12); } 100% { transform: scale(.72); } }
@media (prefers-reduced-motion: reduce) { .breath.on i { animation: none; transform: scale(.95); } }

/* ปุ่มปิดมุมขวาบนของหน้าต่างที่ไม่มีหัว */
.reg-x, .qs-x { position: absolute; top: 8px; right: 8px; z-index: 5; }
.reg-x { background: color-mix(in srgb, var(--card) 85%, transparent); border-radius: 50%; }
.dlg-x { position: sticky; top: 0; float: right; margin: -12px -12px 0 8px; z-index: 5; min-width: 44px; min-height: 44px; border: 0; background: transparent; font-size: 20px; color: var(--muted); }

/* โปรแกรมฝึกกลั้นปัสสาวะ / CIC */
.bp-tabs { grid-template-columns: 1fr 1fr; margin: 4px 0 14px; }
.bp-card h3 { font-size: 15.5px; margin: 14px 0 6px; }
.bp-card h3:first-child { margin-top: 0; }
.bp-card .primary { width: 100%; margin-top: 14px; }
.bp-card .link { display: block; margin: 10px auto 0; }
.bp-chips { flex-wrap: wrap; }
.bp-chips button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.bp-times, .bp-tlist { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.bp-times label, .bp-tlist label { font-size: 13.5px; color: var(--muted); }
.bp-times input, .bp-tlist input { margin-top: 4px; }
.bp-note { font-size: 13px; margin-top: 12px; }
.bp-hero .bp-big { font-size: 20px; margin: 0 0 4px; }
.bp-hero .bp-big b { color: var(--brand); }
.bp-slots { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.bp-slot { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.bp-slot.past { opacity: .45; }
.bp-slot.done { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); opacity: 1; }
.bp-slot.next { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.bp-log { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bp-res { min-height: 56px; font-weight: 600; }
.bp-ontime { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.bp-early { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.bp-leak { background: color-mix(in srgb, var(--danger) 12%, var(--card)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.bp-tip { padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.bp-vol { display: block; font-size: 14px; color: var(--muted); }
.bp-vol input { margin-top: 4px; font-size: 20px; }
.bp-push { font-size: 13px; text-align: center; }
.bp-foot { display: flex; justify-content: space-between; margin: 6px 4px 20px; }
.bp-foot .link { margin: 0; }
details.bp-card summary { font-weight: 600; cursor: pointer; }
details.bp-card ol { margin: 8px 0 0; padding-left: 20px; }

/* ปุ่มกลับบนหัว: เห็นชัด ไม่ถูกบีบ (ซ่อนโลโก้ตอนอยู่หน้าย่อย) */
header.top.has-back .wm { display: none !important; }
header.top.has-back #top-back { margin-left: 0; margin-right: auto; flex-shrink: 0; max-width: none; padding: 8px 12px 8px 4px; color: var(--brand); font-weight: 700; font-size: 16px; }

/* ===== โหมดฝากครรภ์ (modules/preg/ui.js) ===== */
:root { --pg-rose: #b8476a; --pg-soft: #fbeef2; --pg-ring: #f1d3dd; }
[data-theme="dark"] { --pg-rose: #ff9bb8; --pg-soft: rgba(255,155,184,.09); --pg-ring: rgba(255,155,184,.18); }
.pg-home, .pg-entry { border-color: var(--pg-rose); background: var(--pg-soft); }
.pg-home .ic, .pg-entry .ic, .pg-home .q-home-go, .pg-entry > span:last-child { color: var(--pg-rose); width: 30px; height: 30px; }
.pg-lead { margin: 0 0 12px; color: var(--muted); }
.pg-by { flex-wrap: wrap; margin-bottom: 12px; }
.pg-f { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-weight: 600; }
.pg-f input, .pg-f select { font: inherit; font-weight: 400; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink); min-height: 48px; }
.pg-f small { font-weight: 400; color: var(--muted); font-size: 13px; }
.pg-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pg-calc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pg-calc div { background: var(--pg-soft); border-radius: 16px; padding: 12px; }
.pg-calc small { display: block; color: var(--muted); font-size: 13px; } .pg-calc b { font-size: 19px; }
.pg-why { margin: 8px 2px 0; color: var(--muted); font-size: 14px; }
.pg-warn { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--gold-soft); color: var(--ink); font-size: 14px; }
.pg-warn .ic { width: 20px; height: 20px; flex: none; color: var(--gold); }
.pg-hero { display: flex; gap: 18px; align-items: center; padding: 20px 18px; border-radius: 28px; background: var(--card); box-shadow: 0 18px 40px -30px rgba(184,71,106,.7); margin-bottom: 12px; }
.pg-ring { --p: 0; position: relative; flex: none; width: 112px; height: 112px; border-radius: 50%; display: grid; place-content: center; text-align: center; }
.pg-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--pg-rose) calc(var(--p) * 1%), var(--pg-ring) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 79%, #000 80%); mask: radial-gradient(closest-side, transparent 79%, #000 80%); }
.pg-ring > * { position: relative; }
.pg-ring b { font-size: 34px; line-height: 1; color: var(--pg-rose); } .pg-ring b small { font-size: 16px; } .pg-ring span { font-size: 13px; color: var(--muted); }
.pg-hi { display: flex; flex-direction: column; gap: 2px; } .pg-hi b { font-size: 22px; } .pg-hi small { color: var(--muted); font-size: 14px; }
.pg-tri { align-self: flex-start; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--pg-soft); color: var(--pg-rose); font-weight: 600; }
.pg-danger h2, .card h2 .ic { vertical-align: -4px; }
.pg-danger { border: 1.5px solid var(--danger-ink, #b3261e); }
.pg-danger ul { list-style: none; padding: 0; margin: 8px 0 12px; }
.pg-danger li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pg-danger li em { flex: none; font-style: normal; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; align-self: center; }
.pg-danger li.lv-now em { background: var(--danger-soft, #fde7e7); color: var(--danger-ink, #b3261e); }
.pg-danger li.lv-today em { background: var(--gold-soft); color: var(--gold); }
#preg-body a.pg-call { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 16px; background: #c0392b; color: #fff; font-weight: 700; text-decoration: none; margin-bottom: 6px; }
#preg-body a.pg-call .ic { width: 22px; height: 22px; color: #fff; }
.pg-visits { list-style: none; padding: 0; margin: 8px 0; }
.pg-visits li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pg-visits li b { width: 28px; height: 28px; border-radius: 50%; display: grid; place-content: center; background: var(--pg-soft); color: var(--pg-rose); font-size: 14px; }
.pg-visits li em { font-style: normal; color: var(--muted); font-size: 14px; }
.pg-visits li.past { opacity: .5; } .pg-visits li.next b { background: var(--pg-rose); color: #fff; } .pg-visits li.next span { font-weight: 700; }
.pg-small { font-size: 13px; }
.pg-tips { margin: 8px 0; padding-left: 20px; } .pg-tips li { margin: 6px 0; }
.pg-kick { display: flex; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--pg-soft); font-size: 14px; } .pg-kick .ic { flex: none; width: 22px; height: 22px; color: var(--pg-rose); }
.pg-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pg-item label { display: flex; gap: 10px; align-items: flex-start; } .pg-item input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--pg-rose); }
.pg-item span { display: flex; flex-direction: column; } .pg-item small { color: var(--muted); font-size: 13px; }
.pg-item em { display: inline-block; margin: 4px 0 0 32px; font-style: normal; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--muted); }
.pg-item.st-now em { background: var(--pg-rose); color: #fff; } .pg-item.st-soon em { background: var(--pg-soft); color: var(--pg-rose); }
.pg-item.st-ok em { background: var(--up-soft, #e4f4ec); color: var(--up-ink, #12795f); } .pg-item.st-past b { opacity: .7; }
.pg-supp { margin: 8px 0; } .pg-supp small { color: var(--muted); }
.pg-tools { margin: 6px 0 12px; }
.pg-foot { font-size: 12px; color: var(--muted); margin: 14px 4px; line-height: 1.6; } .pg-foot .tag { margin-left: 0; }
.pg-foot a { color: inherit; }
/* สมุดฝากครรภ์ + ป๊อปอัปยินดี */
.pg-congrats { display: grid; place-content: center; width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; background: var(--pg-soft); }
.pg-congrats .ic { width: 40px; height: 40px; color: var(--pg-rose); }
#ask-text .pg-congrats + p { text-align: center; font-weight: 700; }
.pg-log .pg-logbtn { width: 100%; margin-top: 6px; }
.pg-logform { margin-top: 4px; }
.pg-f textarea { font: inherit; font-weight: 400; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--ink); resize: vertical; }
.pg-gain { margin: 4px 0 8px; padding: 8px 12px; border-radius: 12px; background: var(--pg-soft); font-size: 14px; }
.pg-loglist { list-style: none; padding: 0; margin: 10px 0 0; }
.pg-loglist li { padding: 10px 0; border-top: 1px solid var(--line); } .pg-loglist p { margin: 4px 0 0; font-size: 14px; }
.pg-logh { display: flex; align-items: center; gap: 8px; } .pg-logh .pg-tri { align-self: center; }
.pg-x { margin-left: auto; min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.pg-minirow { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.pg-mini { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--pg-rose); background: var(--pg-soft); color: var(--pg-rose); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pg-mini .ic { width: 18px; height: 18px; }

/* ===== ข้อมูลส่วนตัว (modules/account/profile.js) ===== */
.pf-head { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 28px; background: var(--card); margin-bottom: 6px; }
.pf-av { flex: none; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 65%, #e8f7ec 0, #d6efe0 55%, #c3e5d1 100%); box-shadow: inset 0 0 0 3px #fff, 0 10px 24px -14px rgba(43,29,46,.5); }
[data-theme="dark"] .pf-av { background: radial-gradient(circle at 50% 65%, #2b4537 0, #22372c 60%, #1b2c23 100%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.12); }
.pf-av .cv-mascot { width: 100px; height: 100px; object-fit: contain; }
.pf-who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-who b { font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.pf-stage { align-self: flex-start; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.pf-who small { color: var(--muted); font-size: 14px; }
.pf-note { font-size: 13px; margin: 0 6px 12px; }
.pf-bmi { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.pf-dz { flex-wrap: wrap; }
.chips .pf-none { border-style: dashed; }
.chips .pf-none[aria-pressed="true"] { border-style: solid; }
.pf-row { display: flex; justify-content: space-between; margin: 6px 0 12px; }
.pf-save { margin: 8px 0 24px; }
.pf-save .primary { width: 100%; min-height: 52px; box-shadow: 0 12px 28px -14px rgba(43,29,46,.6); }
.drawer-list .pf-chip { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin: 0 0 10px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.pf-chip .cv-mascot { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #e3f4e8; object-fit: contain; }
.pf-chip span { display: flex; flex-direction: column; } .pf-chip small { color: var(--muted); font-size: 13px; }
/* ตัวเลือกโรคประจำตัวแบบจัดกลุ่ม (profile + ลงทะเบียน) */
.dz-yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.dz-yn button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; padding: 10px 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dz-yn button b { font-size: 18px; } .dz-yn button small { font-size: 13px; color: var(--muted); }
.dz-yn button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.dz-none { margin: 10px 2px 0; font-size: 14px; color: var(--muted); }
.dz-picked { margin: 12px 0 4px; } .dz-picked small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.dz-picked .chips { flex-wrap: wrap; } .dz-x span { margin-left: 4px; opacity: .7; }
.dz-groups { margin-top: 10px; border-top: 1px solid var(--line); }
.dz-g { border-bottom: 1px solid var(--line); }
.dz-g summary { color: var(--ink); display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; font-weight: 600; list-style: none; }
.dz-g summary::-webkit-details-marker { display: none; }
.dz-g summary::after { content: '›'; margin-left: auto; font-size: 20px; color: var(--muted); transition: transform .15s; }
.dz-g[open] summary::after { transform: rotate(90deg); }
.dz-g summary em { font-style: normal; font-size: 12px; min-width: 22px; height: 22px; display: grid; place-content: center; border-radius: 999px; background: var(--brand); color: var(--brand-ink); }
.dz-g .chips { flex-wrap: wrap; padding: 0 0 12px; }
.bp-by { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 6px; padding: 2px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-ink); font-size: 13px; }

/* ประวัติแพ้ */
.al-badge { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--card)); vertical-align: middle; }
.al-food { border-color: color-mix(in srgb, var(--danger) 35%, transparent) !important; }
.al-h { font-size: 15px; margin: 14px 0 6px; }
.al-chips { flex-wrap: wrap; }
.al-chips button[aria-pressed="true"] { background: var(--danger); color: #fff; border-color: var(--danger); }
.al-note { font-size: 13px; margin-top: 10px; }
.pf-al { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--danger); font-weight: 600; }
.rep-al { margin-top: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }

/* ===== Health Journey components (kit/hj-ui.js) ===== */
:root { --hj-violet: #7c5cc4; --hj-pink: #c2418f; --hj-plate: #efe7fb; --hj-rail: #d9ccf3; --hj-info: #3563b8; --hj-info-soft: #e7eefb; }
:root[data-theme="dark"] { --hj-violet: #a78bfa; --hj-pink: #f472c4; --hj-plate: #2b2342; --hj-rail: #3a3058; --hj-info: #8fb4ff; --hj-info-soft: #1b2440; }
.hj-scope .hj-banner { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 104px; padding: 16px 18px; border-radius: 22px; margin-bottom: 12px; overflow: hidden;
  background: linear-gradient(120deg, color-mix(in srgb, var(--hj-violet) 22%, var(--card)), color-mix(in srgb, var(--hj-pink) 18%, var(--card))); }
.hj-banner > div { min-width: 0; } .hj-banner h2 { margin: 0 0 4px; font-size: 19px; line-height: 1.3; } .hj-banner p { margin: 0; font-size: 14px; color: var(--muted); }
.hj-banner-img { flex: none; width: 118px; height: auto; max-height: 80px; object-fit: contain; border-radius: 14px; }
@media (max-width: 360px) { .hj-banner-img { width: 92px; } }
.hj-search .sr-only, .hj-scope .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hj-search { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); margin-bottom: 10px; }
.hj-search svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.hj-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; min-height: 46px; outline: none; }
.hj-search:focus-within { border-color: var(--hj-violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hj-violet) 25%, transparent); }
.hj-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; } .hj-tabs::-webkit-scrollbar { display: none; }
.hj-tabs button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.hj-tabs button[aria-pressed="true"] { background: linear-gradient(90deg, var(--hj-pink), var(--hj-violet)); border-color: transparent; color: #fff; font-weight: 700; }
.hj-tabs em { font-style: normal; font-size: 12px; margin-left: 2px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, currentColor 15%, transparent); }
.hj-list { display: flex; flex-direction: column; gap: 8px; }
.hj-row { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.hj-row:hover { border-color: var(--hj-violet); }
.hj-row-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--hj-plate); }
.hj-ic { width: 28px; height: 28px; object-fit: contain; }
.hj-row-main { display: flex; flex-direction: column; min-width: 0; } .hj-row-main b { font-size: 16px; line-height: 1.35; }
.hj-row-main small { color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.hj-row-main .hj-badge { align-self: flex-start; margin-top: 6px; }
.hj-go { color: var(--muted); font-size: 22px; }
.hj-badge { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 12px; font-weight: 700; padding: 3px 9px 3px 6px; border-radius: 999px; }
.hj-badge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hj-badge.st-completed { background: var(--ok-soft); color: var(--ok-ink); }
.hj-badge.st-due { background: var(--warn-soft); color: var(--warn-ink); }
.hj-badge.st-check { background: var(--hj-info-soft); color: var(--hj-info); }
.hj-badge.st-unknown { background: var(--brand-soft); color: var(--muted); }
.hj-empty { margin: 6px 2px; color: var(--muted); font-size: 14px; }
/* ไทม์ไลน์ช่วงวัย */
.hj-tl { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.hj-tl::before { content: ''; position: absolute; left: 31px; top: 24px; bottom: 24px; width: 3px; border-radius: 3px; background: var(--hj-rail); }
.hj-tl-item { position: relative; margin-bottom: 8px; }
.hj-tl-item > details > summary { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 6px 10px 6px 0; cursor: pointer; list-style: none; border-radius: 16px; }
.hj-tl-item > details > summary::-webkit-details-marker { display: none; }
.hj-tl-item > details > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hj-age { position: relative; z-index: 1; flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--hj-plate); box-shadow: 0 0 0 3px var(--bg); }
.hj-age-img { width: 52px; height: 52px; object-fit: contain; object-position: bottom; }
.hj-age-unk { font-size: 22px; font-weight: 700; color: var(--muted); }
.hj-tl-item.is-now .hj-age { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--hj-pink); }
.hj-tl-h { display: flex; flex-direction: column; flex: 1; } .hj-tl-h b { font-size: 16px; color: var(--ink); } .hj-tl-h small { color: var(--muted); font-size: 13px; }
.hj-now { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--hj-pink); color: #fff; }
.hj-count { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; display: grid; place-content: center; font-size: 13px; font-weight: 700; background: var(--hj-plate); color: var(--hj-violet); }
.hj-tl-item.is-empty .hj-count { opacity: .55; }
.hj-tl-item > details > summary::after { content: '›'; font-size: 22px; color: var(--muted); transition: transform .15s; }
.hj-tl-item > details[open] > summary::after { transform: rotate(90deg); }
.hj-tl-body { position: relative; z-index: 1; padding: 2px 0 8px 12px; }
/* รายละเอียด */
.hj-dhead { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 22px; margin-bottom: 10px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--hj-violet) 20%, var(--card)), color-mix(in srgb, var(--hj-pink) 14%, var(--card))); }
.hj-dhead h3 { margin: 0; font-size: 20px; line-height: 1.3; } .hj-dhead p { margin: 2px 0 6px; color: var(--muted); font-size: 14px; }
.hj-back { flex: none; align-self: flex-start; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.hj-dpic { flex: none; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--hj-plate); }
.hj-dimg { width: 52px; height: 52px; object-fit: contain; }
.hj-callout { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; margin-bottom: 10px; font-size: 14px; }
.hj-callout.st-due { background: var(--warn-soft); color: var(--warn-ink); } .hj-callout.st-check { background: var(--hj-info-soft); color: var(--hj-info); }
.hj-callout.st-unknown { background: var(--brand-soft); color: var(--ink); }
.hj-card { padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); margin-bottom: 10px; }
.hj-card h4 { margin: 0 0 8px; font-size: 16px; } .hj-card p { margin: 0; }
.hj-doses { list-style: none; margin: 0; padding: 0; position: relative; }
.hj-doses li { position: relative; display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 6px 0 10px; }
.hj-doses li:not(:last-child)::before { content: ''; position: absolute; left: 8px; top: 24px; bottom: -6px; width: 2px; background: var(--hj-rail); }
.hj-dot { width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; background: var(--ok); box-shadow: inset 0 0 0 4px var(--card); border: 2px solid var(--ok); box-sizing: border-box; }
.hj-doses li > div { display: flex; flex-direction: column; } .hj-doses small { color: var(--muted); font-size: 13px; }
.hj-place { display: inline-flex; align-items: center; gap: 4px; } .hj-ic-s { width: 18px; height: 18px; object-fit: contain; }
.hj-acts { grid-column: 2; display: flex; gap: 8px; margin-top: 4px; } .hj-acts .small { min-height: 44px; }
.hj-cta { width: 100%; min-height: 52px; margin: 6px 0 12px; }
.hj-review > summary { min-height: 48px; }
@media (prefers-reduced-motion: reduce) { .hj-tl-item > details > summary::after, .dz-g summary::after { transition: none; } }

.banner .btn-link { padding: 6px 14px; border-radius: 99px; font-size: 14px; white-space: nowrap; }
