/* CHEEVA v3 — shared, additive UI layer for patient and doctor applications.
   Preserves functional clinical logic and existing accessible components. */
:root {
 --cheeva-purple:#7b61ff;--cheeva-pink:#e983b8;--cheeva-mint:#34d399;
 --cheeva-cream:#faf4f0;--cheeva-ink:#0f172a;
}
body { -webkit-font-smoothing:antialiased; }
:where(button,a,input,select,textarea):focus-visible {outline:3px solid #7b61ff;outline-offset:3px;}
:where(.card,.tile,.dcard,.cv-knowledge-tile,.cv-ai-bubble){border-radius:20px;}
/* Patient experience */
body:not(.simple) .cv-home-brand {display:flex;align-items:center;gap:11px;padding:8px 3px 14px;}
body:not(.simple) .cv-home-brand img {width:44px;height:44px;object-fit:contain;}
body:not(.simple) .cv-home-brand strong {display:block;letter-spacing:.13em;font-size:20px;color:var(--ink);line-height:1.15;}
body:not(.simple) .cv-home-brand small {display:block;font-size:11px;color:var(--muted);}
body:not(.simple) #view-home .dash-head {border-radius:25px;padding:23px 18px;background:linear-gradient(125deg,#d8d4ff,#f8d8eb 62%,#ffebce);color:#182238;}
body:not(.simple) #view-home .dash-head :is(h1,p){color:#182238;}
body:not(.simple) .cv-shortcuts {grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;}
body:not(.simple) .cv-shortcut {min-width:0;min-height:90px;padding:13px 5px;border-radius:19px;background:rgba(255,255,255,.94);box-shadow:0 8px 24px rgba(80,67,130,.09);}
body:not(.simple) .cv-shortcut span{font-size:12.5px;line-height:1.35;overflow-wrap:anywhere;}
body:not(.simple) .cv-shortcut .ic {color:#8068e6;}
body:not(.simple) #view-guide .cv-knowledge-hero {border-radius:24px;background:linear-gradient(130deg,#dff8f4,#e0eaff 60%,#f5dff7);color:#182238;}
body:not(.simple) #view-guide .cv-knowledge-tile {border-radius:21px;}
body:not(.simple) #view-cheeva-assistant .cv-ai-head {background:linear-gradient(135deg,#dce9ff,#f7d8ed 65%,#efe4ff);}
body:not(.simple) .cv-ai-lotus img {display:block;width:76px;height:76px;object-fit:contain;margin:auto;}
body:not(.simple) nav.bottom {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;padding-left:5px;padding-right:5px;}
body:not(.simple) nav.bottom button {min-width:0;white-space:normal;font-size:13px;line-height:1.2;padding-inline:1px;}
body:not(.simple) nav.bottom button .ic {width:21px;height:21px;}
body:not(.simple) nav.bottom button[aria-current=page]{color:#7b61ff;}
body:not(.simple) header.top .wm {display:inline-flex;align-items:center;gap:7px;}
body:not(.simple) header.top .wm-mark{width:26px;height:26px;object-fit:contain;}
/* Doctor experience: restrained palette, consistent brand, clinical readability */
body:has(> header > h1 > img.wm-mark) header {background:linear-gradient(120deg,rgba(229,220,250,.8),rgba(222,245,240,.7));}
body:has(> header > h1 > img.wm-mark) header h1 {display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
body:has(> header > h1 > img.wm-mark) header .wm-mark{display:inline-block;width:32px;height:32px;object-fit:contain;flex-shrink:0;}
body:has(> header > h1 > img.wm-mark) main .tile {border-radius:20px;}
:root[data-theme=dark] body:not(.simple) #view-home .dash-head{background:linear-gradient(135deg,#29234d,#503266 62%,#263c54);}
:root[data-theme=dark] body:not(.simple) #view-home .dash-head :is(h1,p){color:#fff;}
:root[data-theme=dark] body:not(.simple) .cv-shortcut{background:#292448;}
:root[data-theme=dark] body:not(.simple) #view-guide .cv-knowledge-hero{background:linear-gradient(135deg,#153d48,#352957);color:#fff;}
:root[data-theme=dark] body:not(.simple) #view-cheeva-assistant .cv-ai-head{background:linear-gradient(135deg,#25254e,#492b60);}
:root[data-theme=dark] body:has(> header > h1 > img.wm-mark) header{background:linear-gradient(120deg,#262342,#1a383d);}
@media(max-width:360px){body:not(.simple) nav.bottom button{font-size:12px;}body:not(.simple) .cv-shortcut span{font-size:11.5px;}}
@media print{body:not(.simple) nav.bottom{display:none!important;}}
@media(prefers-reduced-motion:reduce){.cv-shortcut,.cv-knowledge-tile{animation:none!important;transition:none!important;}}

/* Health trends and clinician dashboard */
body:not(.simple) .cv-track-hero{padding:24px 20px;border-radius:25px;background:linear-gradient(135deg,#e7d9ff,#fce2ef 62%,#e2f8ee);color:#17243a;}
body:not(.simple) .cv-track-hero h1{margin:6px 0 8px;font-size:27px;color:#17243a;}
body:not(.simple) .cv-track-hero p{margin:0;color:#495369;}
body:not(.simple) .cv-track-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:15px 0;}
body:not(.simple) .cv-track-actions button{border-radius:16px;padding:12px 8px;background:var(--card);border:1px solid var(--cv-line);font-size:13px;font-weight:600;}
body:not(.simple) .cv-track-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
body:not(.simple) .cv-track-grid .dcard{display:block;width:100%;min-width:0;min-height:140px;cursor:default;text-align:left;border:1px solid var(--cv-line);border-radius:20px;padding:16px;background:var(--card);box-shadow:var(--cv-shadow);}
body:not(.simple) .cv-track-grid .dcard:first-child{grid-column:1/-1;}
body:not(.simple) .cv-track-grid .dcard .v{font-size:26px;font-weight:700;}
body:not(.simple) .cv-track-grid .dcard .v i{font-size:12px;font-weight:400;margin-left:5px;}
body:not(.simple) .cv-track-grid .dcard svg{max-width:100%;}
.cv-clinician-hero{padding:22px 20px;border-radius:24px;background:linear-gradient(125deg,#e3dcff,#f8e2f0 60%,#e4f7f2);color:#182238;margin-bottom:14px;}
.cv-clinician-hero h2{margin:5px 0 8px;font-size:23px;color:#182238;}
.cv-clinician-hero p{margin:0;font-size:13px;line-height:1.6;color:#495369;}
.cv-clinician-shortcuts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin:12px 0 20px;}
.cv-clinician-shortcuts button{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0;min-height:106px;padding:13px 6px;border-radius:18px;background:var(--card,#fff);border:1px solid rgba(140,124,185,.2);box-shadow:0 5px 16px rgba(71,53,121,.08);text-align:center;}
.cv-clinician-shortcuts button span{font-size:25px;color:#7b61ff;}
.cv-clinician-shortcuts button strong{font-size:11px;overflow-wrap:anywhere;}
.cv-clinician-shortcuts button small{font-size:10px;line-height:1.3;color:var(--muted,#64748b);}
:root[data-theme=dark] body:not(.simple) .cv-track-hero{background:linear-gradient(125deg,#28234e,#543361 65%,#1d3d45);}
:root[data-theme=dark] body:not(.simple) .cv-track-hero :is(h1,p){color:#fff;}
:root[data-theme=dark] .cv-clinician-hero{background:linear-gradient(125deg,#28234e,#543361 65%,#1d3d45);}
:root[data-theme=dark] .cv-clinician-hero :is(h2,p){color:#fff;}
:root[data-theme=dark] .cv-clinician-hero .cv-eyebrow{color:#ffc7ea;}
body .cv-clinician-hero span.cv-eyebrow{color:#5a4f86;}
@media(max-width:480px){.cv-clinician-shortcuts{grid-template-columns:repeat(2,minmax(0,1fr));}}
/* อ่านง่ายบนพื้นพาสเทล: วันที่และปุ่มช่วงเวลาที่ไม่ได้เลือก */
body:not(.simple) #view-home .dash-head .muted{color:#4a4560;}
body:not(.simple) #view-home .dash-head .dash-range{background:rgba(255,255,255,.55);}
body:not(.simple) #view-home .dash-head .dash-range button:not([aria-pressed=true]){color:#2c2a40;}
/* โลโก้มีที่หัวจอแล้ว ไม่ต้องซ้ำในหน้าแรก */
body:not(.simple) .cv-home-brand{display:none;}
/* โหมดตัวใหญ่ ปุ่มน้อย: ไม่แสดงโลโก้ซ้ำและทางลัด 4 ปุ่ม */
body.simple .cv-home-brand, body.simple .cv-shortcuts{display:none!important;}
/* หน้าความรู้: แท็บหัวข้อมีอยู่แล้ว ไม่ต้องมีการ์ดซ้ำ · คำโปรยตัดออก หัวข้ออ่านชัด */
.cv-knowledge-grid{display:none!important;}
.cv-knowledge-hero p{display:none;}
body:not(.simple) .cv-knowledge-hero{padding:16px 18px;min-height:0;}
body:not(.simple) .cv-knowledge-hero h2{color:#182238;}
body:not(.simple) .cv-knowledge-hero .cv-eyebrow{color:#5a4f86;}
body:not(.simple) .cv-knowledge-hero img{width:64px;height:64px;object-fit:contain;}
:root[data-theme=dark] body:not(.simple) .cv-knowledge-hero h2{color:#fff;}
:root[data-theme=dark] body:not(.simple) .cv-knowledge-hero .cv-eyebrow{color:#cdbfff;}
/* นิ้วแตะได้ ≥44 px */
body:not(.simple) #view-home .dash-head .dash-range button{min-height:44px;}
.mh-hint{min-width:44px;min-height:44px;}
/* เมนูล่างลอยขึ้นกลางจอบน iPhone: Safari วาดแถบ position:fixed ที่มี backdrop-filter ผิดตำแหน่งระหว่างเลื่อนหน้ายาว
   ใช้พื้นทึบ แยกเป็นเลเยอร์ของตัวเอง และยึดกับขอบล่างจอ */
html body nav.bottom{position:fixed!important;left:0!important;right:0!important;bottom:0!important;top:auto!important;
  -webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--bg,#fff)!important;
  -webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);will-change:transform;-webkit-backface-visibility:hidden;backface-visibility:hidden;}
