/* พอดีหน้าจอมือถือ/iPad: ไม่ติดขอบ ไม่เลยขอบ รองรับ notch/safe-area */
html{-webkit-text-size-adjust:100%;max-width:100%}
body{max-width:100%;overflow-x:clip}
img,video,canvas,svg,iframe{max-width:100%}
input,select,textarea,button{max-width:100%;box-sizing:border-box}
dialog{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain}
dialog form{max-width:100%;box-sizing:border-box}
@media(max-width:1023px){
  .app-shell{width:auto!important;max-width:100%!important;margin-inline:0!important;padding-left:env(safe-area-inset-left)!important;padding-right:env(safe-area-inset-right)!important;box-sizing:border-box}
  .planner-grid,.dashboard-stats,.field-split{min-width:0}
  .planner-grid>*,.field-split>*{min-width:0}
  .activity-card,.activity-card *{overflow-wrap:anywhere}
}
@media(max-width:1023px){.mobile-tabbar{padding-left:max(9px,env(safe-area-inset-left))!important;padding-right:max(9px,env(safe-area-inset-right))!important;box-sizing:border-box;max-width:100vw}}
@media(max-width:480px){.field-split{grid-template-columns:1fr!important}}
/* เหมือนแอปจริง: ไม่ซูมด้วยนิ้ว ไม่ดึงรีเฟรช ไม่เด้งขอบ ไม่เลือกข้อความโดยไม่ตั้งใจ */
@media(pointer:coarse){
html,body{touch-action:pan-x pan-y;overscroll-behavior:none;-webkit-tap-highlight-color:transparent}
body{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
input,textarea,[contenteditable],.selectable{-webkit-user-select:text;user-select:text;touch-action:manipulation}
img{-webkit-user-drag:none;user-drag:none}
input,select,textarea{font-size:16px!important}
}
/* ชิดขอบซ้าย-ขวาเต็มจอ (มือถือ/แท็บเล็ต): แถบบน การ์ด และแท็บไม่มีช่องว่างข้างๆ */
@media(max-width:1023px){
  html body .topbar{left:0!important;right:0!important;width:100%!important;max-width:100%!important;margin:0!important;border-radius:0!important;box-sizing:border-box;padding-left:max(16px,env(safe-area-inset-left))!important;padding-right:max(16px,env(safe-area-inset-right))!important}
  html body .app-shell{width:100%!important;max-width:100%!important;margin:0!important}
  html body .app-shell>*,html body .trip-hero,html body .schedule-panel,html body .panel,html body .trip-dashboard,html body .share-panel,html body .dashboard-state,html body .trip-list-state,html body .signed-out-state,html body .chat-state{margin-left:0!important;margin-right:0!important;max-width:100%!important;border-left:0!important;border-right:0!important;border-radius:0!important;box-sizing:border-box}
  html body .day-tabs{margin-left:0!important;margin-right:0!important;padding-left:16px!important;padding-right:16px!important;scroll-padding-inline:16px}
}
/* แถบเขียวบนสุดเหมือนหน้าโน้ตทุกหน้า: ชิดบนสุดของจอ ครอบคลุมพื้นที่นาฬิกา/Dynamic Island */
@media(max-width:1023px){
  html,body{margin:0!important}
  html body .topbar{position:sticky!important;top:0!important;z-index:40!important;box-sizing:border-box!important;height:calc(56px + env(safe-area-inset-top))!important;padding-top:env(safe-area-inset-top)!important;margin-top:0!important}
  html body.notes-open .topbar{position:fixed!important}
}
/* โน้ต: ปุ่มลบเมื่อปัดซ้าย */
.nt-group{position:relative;overflow:hidden}
.nt-row{touch-action:pan-y}
.nt-swipe-del{position:absolute;right:0;z-index:0;display:flex;align-items:center;justify-content:center;border:0;background:#ff3b30;color:#fff;font:700 1rem inherit;font-family:inherit;overflow:hidden;white-space:nowrap;padding:0}

/* โน้ต: สลับส่วนตัว/ทริป, ผู้สร้าง, ประวัติแก้ไข */
.nt-scope{display:flex;gap:6px;margin:0 16px 10px;padding:3px;border-radius:10px;background:#e3e3e8}
.nt-scope button{flex:1;border:0;border-radius:8px;padding:7px 8px;background:none;font:600 .86rem inherit;font-family:inherit;color:#3c3c43}
.nt-scope button.on{background:#fff;box-shadow:0 1px 3px #0002;color:#117f89}
.nt-by{font-style:normal;font-weight:700;color:#117f89;margin-right:4px}
.nt-meta{margin:0 0 10px;font-size:.8rem;color:#6c6c70}
.nt-log-btn{margin-top:4px;border:0;background:none;color:#117f89;font:600 .8rem inherit;font-family:inherit;padding:2px 0}
.nt-log{margin:6px 0 0;padding:8px 12px 8px 28px;border-radius:10px;background:#f2f2f7;max-height:160px;overflow:auto}
.nt-log li{margin:2px 0}.nt-log span{color:#8e8e93;margin-left:6px}

/* เมนูด่วน: ซ่อนรายการที่ไม่เกี่ยวกับหน้านั้นจริงๆ (hidden ถูก display ของปุ่มทับ) */
.quick-action[hidden],.quick-action--home[hidden],.quick-action--trip[hidden]{display:none!important}

/* จอใหญ่ (คอม/แท็บเล็ตแนวนอน ≥1024px) ไม่มีแถบเมนูล่าง จึงต้องมีปุ่มเพิ่มกิจกรรม/เช็กลิสต์ในหน้า */
@media(min-width:1024px){
  html body #addActivity,html body #addCheck{display:inline-flex!important}
  html body.view-only #addActivity,html body.view-only #addCheck,html body.is-guest.view-only #addActivity{display:none!important}
}
/* หน้า login บนจอกว้างให้เหมือนมือถือ (พื้นเขียวเต็มจอ ปุ่มเหลือง) */
@media(min-width:651px){
  html body .signed-out-state{position:relative;overflow:hidden;width:100%!important;max-width:none!important;margin:0!important;min-height:calc(100vh - 72px);padding:62px 25px 45px!important;border-radius:0 0 42px 42px!important;background:linear-gradient(145deg,#148b95,#117d88)!important;color:#fff;box-shadow:none!important;display:block}
  html body .signed-out-state:before{content:"";position:absolute;width:300px;height:300px;right:-120px;top:-110px;border-radius:50%;background:#ffd33f;opacity:.22}
  html body .signed-out-state:after{content:"";position:absolute;width:260px;height:260px;left:-120px;bottom:-130px;border-radius:50%;background:#c7b6ff;opacity:.22}
  html body .signed-out-state>*{position:relative;z-index:1;max-width:420px;margin-left:auto;margin-right:auto}
  html body .signed-out-state .gate-mascot{display:block!important;width:min(235px,62vw);margin:0 auto 19px;filter:drop-shadow(0 18px 18px #2d17693d)}
  html body .signed-out-state .natgo-kicker{font-size:.78rem!important;color:#ffd33f!important}
  html body .signed-out-state .natgo-tagline{color:#efffff!important;font-size:1.15rem!important;font-weight:600;margin:10px auto 28px!important}
  html body .signed-out-state .explore-button{width:100%;min-height:58px;justify-content:center;border-radius:22px;background:#ffd33f!important;border-color:#ffd33f!important;color:#22203e!important;box-shadow:0 8px 0 #0e6972}
  html body .signed-out-state .guest-login{color:#fff}
  html body .signed-out-state .gate-note{color:#e5ffff!important;font-size:.83rem!important}
}
@media(min-width:651px){html body .signed-out-state .natgo-kicker{display:block;width:100%;text-align:center;margin:0 auto 6px!important;max-width:420px}}
