/* ================================================================
   02-layout-and-greetings.css
   หมวด: การจัดวางแบบ responsive และส่วนทักทาย/ปฏิทิน
   หมายเหตุ: ไฟล์ถูกโหลดตามลำดับใน index.html เพื่อคงลำดับ CSS เดิม
   ================================================================ */
/* =========================================================
   Mobile-first Cute + Modern refresh — iPhone 15 / 17
   App-like layout, safe areas, no iOS input auto-zoom,
   playful micro-interactions (reduced-motion aware).
   ========================================================= */
:root{
 --mobile-ink:#29264b;
 --mobile-glass:rgba(255,255,255,.82);
 --mobile-border:rgba(255,255,255,.92);
 --mobile-shadow:0 12px 30px rgba(76,57,130,.09);
}
html{
 min-height:100%;
 -webkit-text-size-adjust:100%;
 text-size-adjust:100%;
 scroll-padding-top:20px;
}
body{
 min-height:100vh;
 min-height:100dvh;
 -webkit-tap-highlight-color:transparent;
 overscroll-behavior-y:contain;
}
button,a,input,select,textarea{
 touch-action:manipulation;
}
button,.btn,.nav,.mobile-nav button,.wizard-choice{
 -webkit-appearance:none;
}
button,.btn,.nav,.mobile-nav button{
 -webkit-user-select:none;
 user-select:none;
}
.top{
 position:relative;
}
.top h1{
 line-height:1.25;
 /* จองพื้นที่ข้อความไว้ล่วงหน้า ป้องกันหัวเว็บกระโดดเมื่อเปลี่ยนคำทักทาย */
 min-height:1.25em;
}
#greetingText{display:inline;transition:opacity .72s ease,filter .72s ease,transform .72s ease;will-change:opacity,filter,transform}
#greetingSub{min-height:1.55em;transition:opacity .72s ease,filter .72s ease,transform .72s ease;will-change:opacity,filter,transform}
.hello-sparkle{
 display:inline-block;
 color:var(--greeting-day-a,#f36e9c);
 transform-origin:center;
 animation:helloWiggle 2.8s ease-in-out infinite,helloDayColor 5.5s ease-in-out infinite;
 text-shadow:0 3px 14px color-mix(in srgb,var(--greeting-day-a,#f36e9c) 24%,transparent);
}
#greetingText.greeting-changing,#greetingSub.greeting-changing{opacity:0;filter:blur(3px);transform:translateY(5px)}
@media (max-width:600px){.top h1{min-height:2.5em}#greetingText{display:inline}#greetingSub{min-height:3.1em}}
@media (prefers-reduced-motion:reduce){#greetingText,#greetingSub{transition:none!important;transform:none!important;filter:none!important}}
@keyframes helloDayColor{0%,100%{color:var(--greeting-day-a)}50%{color:var(--greeting-day-b)}75%{color:var(--greeting-day-c)}}
@keyframes helloWiggle{
 0%,100%{transform:rotate(0) scale(1)}
 25%{transform:rotate(-12deg) scale(1.12)}
 55%{transform:rotate(9deg) scale(1.04)}
}
.stat,.panel,.goal-card,.budget-row{
 box-shadow:var(--mobile-shadow);
 backdrop-filter:blur(14px);
 -webkit-backdrop-filter:blur(14px);
}
.stat{
 position:relative;
 overflow:hidden;
}
.stat::after{
 content:"";
 position:absolute;
 width:88px;height:88px;
 right:-36px;top:-38px;
 border-radius:50%;
 background:linear-gradient(135deg,#ffffff90,#f8e8ff35);
 pointer-events:none;
}
.panel-head .btn,.actions .btn,.top-actions .btn{
 min-height:42px;
}
.btn:focus-visible,.nav:focus-visible,
.mobile-nav button:focus-visible{
 outline:3px solid #c8b8ff;
 outline-offset:3px;
}
input,select,textarea{
 font-size:16px;
}
.field input,.field select,.field textarea,
.wizard-input,.pill{
 font-size:16px;
}
#authGate input{
 font-size:16px;
}
.mobile-nav{
 padding-left:max(5px,env(safe-area-inset-left));
 padding-right:max(5px,env(safe-area-inset-right));
 padding-bottom:calc(7px + env(safe-area-inset-bottom));
 box-shadow:0 -8px 30px rgba(65,46,112,.08);
}
.mobile-nav button{
 min-height:48px;
 border-radius:14px;
}
.mobile-nav button span{
 display:block;
 line-height:1.25;
 margin-bottom:2px;
 transition:transform .22s cubic-bezier(.2,.8,.2,1);
}
.mobile-nav button.active span{
 transform:translateY(-2px) scale(1.12);
}
.mobile-more{
 bottom:calc(76px + env(safe-area-inset-bottom));
 padding:12px;
}
.mobile-more button{
 min-height:46px;
}
.toast{
 max-width:calc(100vw - 28px);
 width:max-content;
 text-align:center;
 bottom:calc(18px + env(safe-area-inset-bottom));
}
.wizard-backdrop{
 padding:
  max(10px,env(safe-area-inset-top))
  max(10px,env(safe-area-inset-right))
  max(10px,env(safe-area-inset-bottom))
  max(10px,env(safe-area-inset-left));
}
.wizard-card{
 overscroll-behavior:contain;
 -webkit-overflow-scrolling:touch;
}
#lineLinkModal{
 padding:
  max(18px,env(safe-area-inset-top))
  max(18px,env(safe-area-inset-right))
  max(18px,env(safe-area-inset-bottom))
  max(18px,env(safe-area-inset-left)) !important;
}
#lineLinkModal [role="dialog"]{
 max-height:calc(100dvh - 36px);
 overflow:auto;
 -webkit-overflow-scrolling:touch;
}
.calendar-grid{
 gap:clamp(2px,1vw,6px);
}
.calendar-day{
 overflow-wrap:anywhere;
}
.transactions{
 -webkit-overflow-scrolling:touch;
 scrollbar-width:thin;
}
@media(max-width:900px){
 .app{display:block;min-height:100vh;min-height:100dvh}
 .main{
  width:100%;
  max-width:760px;
  margin:0 auto;
  padding:
   max(15px,env(safe-area-inset-top))
   max(12px,env(safe-area-inset-right))
   calc(112px + env(safe-area-inset-bottom))
   max(12px,env(safe-area-inset-left));
 }
 .top{
  display:block;
  padding:17px 16px 15px;
  margin:0 -1px 14px;
  border:1px solid #ffffffc9;
  border-radius:24px;
  background:linear-gradient(135deg,rgba(255,255,255,.87),rgba(255,247,252,.78));
  box-shadow:0 10px 28px rgba(76,57,130,.06);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
 }
 .top h1{font-size:clamp(25px,6vw,32px);margin-top:5px}
 .top .sub{font-size:13px}
 .top-actions{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:8px;
  margin-top:14px;
 }
 .top-actions .weather-pill{
  grid-column:1/-1;
  width:100%;
  min-width:0;
  justify-content:flex-start;
  padding:9px 11px;
 }
 .top-actions #month{
  width:100%;
  max-width:none;
  min-width:0;
  min-height:42px;
 }
 .top-actions #accountLabel{display:none}
 .top-actions #signOutBtn,.top-actions #addTop{
  width:100%;
  min-width:0;
  min-height:43px;
  white-space:normal;
 }
 .stats{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px;
  margin-bottom:12px;
 }
 .stat{
  min-width:0;
  padding:14px 12px;
  border-radius:20px;
  display:flex;
  align-items:flex-start;
  gap:10px;
 }
 .stat:nth-child(3){
  grid-column:1/-1;
  align-items:center;
  padding:14px;
 }
 .stat-icon{
  width:40px;height:40px;
  border-radius:14px;
  margin:0;
  flex-shrink:0;
 }
 .stat label{font-size:12px;line-height:1.4;display:block}
 .money{font-size:clamp(17px,4.7vw,22px);line-height:1.3}
 .stats .hint{font-size:10px;line-height:1.45}
 .layout{grid-template-columns:minmax(0,1fr);gap:0}
 .panel{
  min-width:0;
  border-radius:22px;
  padding:16px 14px;
  margin-bottom:12px;
 }
 .panel-head{align-items:flex-start}
 .panel h2{font-size:16px;line-height:1.4}
 .panel p{font-size:11px;line-height:1.5}
 .chart{height:145px;gap:7px}
 .barlabel{font-size:9px}
 .legend{font-size:11px}
 .transactions{max-width:100%;border-radius:12px}
 table{min-width:520px}
 .formgrid{grid-template-columns:minmax(0,1fr)}
 .field.full{grid-column:auto}
 .field input,.field select,.field textarea{min-height:46px}
 .actions{gap:8px}
 .actions .btn{min-height:44px}
 .calendar-day{min-height:64px}
 .calendar-event{font-size:9px}
 .goal-grid{grid-template-columns:minmax(0,1fr)}
 .mobile-nav{
  display:flex;
  gap:3px;
  min-height:65px;
  background:rgba(255,255,255,.91);
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
 }
 .mobile-nav button{
  flex:1 1 0;
  min-width:0;
  font-size:10px;
  padding:7px 2px;
 }
 .mobile-nav button span{font-size:20px}
}
@media(max-width:390px){
 .main{padding-left:10px;padding-right:10px}
 .top{padding:14px 12px}
 .stat{padding:12px 9px;gap:8px}
 .stat-icon{width:35px;height:35px;font-size:17px}
 .money{font-size:16px}
 .stats .hint{font-size:9px}
 .panel{padding:13px 11px}
 .top-actions .btn{font-size:12px;padding:8px}
 .calendar-day{min-height:57px}
 .calendar-event{font-size:8px}
}
@media(min-width:901px){
 .top{padding:4px 0}
 .stat:hover,.panel:hover,.goal-card:hover{
  transform:translateY(-2px);
  box-shadow:0 16px 38px rgba(76,57,130,.12);
 }
}
