/* Health Screening — mobile web-app layer (2026-10-16)
   Pure presentation: keeps the existing PHP permissions and data flow intact. */
:root{
  --app-accent:#0b786a;
  --app-accent-2:#159476;
  --app-ink:#173d36;
  --app-surface:#ffffff;
  --app-bg:#eef5f2;
  --app-line:#dce9e4;
  --app-shadow:0 18px 45px rgba(26,70,59,.10);
  --safe-top:env(safe-area-inset-top,0px);
  --safe-right:env(safe-area-inset-right,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  --safe-left:env(safe-area-inset-left,0px);
}
html{background:var(--app-bg);-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{-webkit-tap-highlight-color:transparent}
button,a,input,select,textarea{touch-action:manipulation}
.app-brand-icon{overflow:hidden;padding:0!important;background:transparent!important;border:0!important;box-shadow:0 10px 24px rgba(0,0,0,.13)}
.app-brand-icon img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.mobile-app-mark,.mobile-app-dock{display:none}

/* More app-like surfaces on every screen without changing page semantics. */
.card{border-color:#e0ebe6;box-shadow:0 8px 24px rgba(25,66,55,.045)}
.btn,button{min-height:42px}
input,select,textarea{min-height:44px}
.table-wrap{border-radius:16px;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}

/* Login logo lockup: visible on desktop and mobile. */
.auth-logo-lockup{display:flex;align-items:center;gap:13px;margin:0 0 24px}
.auth-logo-lockup .auth-logo{margin:0!important;display:grid!important;place-items:center;flex:0 0 auto;overflow:hidden;padding:0!important;background:#fff!important;border:1px solid #dcebe3!important;box-shadow:0 12px 28px rgba(28,86,67,.12)!important}
.auth-logo-lockup .auth-logo img{display:block;width:100%;height:100%;object-fit:cover}
.auth-logo-copy{display:flex;flex-direction:column;line-height:1.15;color:#245343}
.auth-logo-copy strong{font-size:17px;letter-spacing:-.02em}
.auth-logo-copy small{font-size:10px;color:#789084;margin-top:5px}

/* Standalone mode: feels like an installed application. */
html.is-standalone body:not([data-page=login]) .topbar{padding-top:var(--safe-top);height:calc(68px + var(--safe-top))}
html.is-standalone body:not([data-page=login]) main{padding-bottom:calc(108px + var(--safe-bottom))}

@media(max-width:760px){
  html,body{min-height:100%;background:var(--app-bg)}
  body:not([data-page=login]){min-height:100dvh;background:linear-gradient(180deg,#f7fbf9 0,#edf4f1 210px,#edf4f1 100%);overscroll-behavior-y:none;padding-bottom:calc(78px + var(--safe-bottom))}
  body:not([data-page=login]) .shell{margin-left:0!important;min-height:100dvh;display:flex;flex-direction:column}
  body:not([data-page=login]) .topbar{height:64px;position:sticky;top:0;padding:0 calc(12px + var(--safe-right)) 0 calc(12px + var(--safe-left));background:rgba(255,255,255,.88);border-bottom:1px solid rgba(210,229,221,.92);backdrop-filter:saturate(150%) blur(18px);-webkit-backdrop-filter:saturate(150%) blur(18px);box-shadow:0 7px 24px rgba(33,75,62,.055);z-index:40}
  .topbar-left{gap:8px;min-width:0;flex:1}
  .mobile-app-mark{display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;border-radius:11px;overflow:hidden;box-shadow:0 7px 18px rgba(20,101,78,.18)}
  .mobile-app-mark img{width:100%;height:100%;display:block}
  .topbar-heading{min-width:0;max-width:calc(100vw - 205px)}
  .topbar-heading .breadcrumb{display:none}
  .topbar-heading strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px!important;color:#234a40}
  .menu-toggle{width:36px!important;height:36px!important;border-radius:12px!important;background:#edf6f2!important;color:#26725d!important}
  .topbar-right{gap:5px!important;flex:0 0 auto}
  .topbar-right .date-chip,.topbar-right .topbar-user,.topbar-right>a[aria-label="คู่มือการใช้งาน"]{display:none!important}
  .topbar-right .chat-bell{width:36px;height:36px;min-height:36px;padding:0!important;border-radius:12px!important;font-size:0!important;display:grid!important;place-items:center;position:relative;background:#edf6f2!important;color:#276d5b!important}
  .topbar-right .chat-bell:before{content:'💬';font-size:16px;line-height:1}
  .topbar-right .chat-bell #chatUnreadBadge{position:absolute;right:-3px;top:-5px;min-width:17px;height:17px;padding:0 4px;border-radius:999px;background:#d94162;color:white;display:grid;place-items:center;font-size:9px;border:2px solid white}
  .topbar-right>a[aria-label="คำขอเข้าใช้งาน"]{width:36px;height:36px;min-height:36px;padding:0!important;border-radius:12px!important;font-size:12px!important;display:flex!important;align-items:center;justify-content:center;gap:1px}
  .topbar-right form{margin:0}
  .topbar-right .logout-button{width:36px!important;height:36px!important;border-radius:12px!important}

  body:not([data-page=login]) main{width:100%;padding:16px calc(13px + var(--safe-right)) calc(104px + var(--safe-bottom)) calc(13px + var(--safe-left));flex:1;overflow-x:hidden}
  body:not([data-page=login]) main>.notice:first-child{border-radius:14px;padding:11px 13px;margin-bottom:14px;font-size:10px;box-shadow:0 7px 20px rgba(31,87,70,.04)}
  .hero{border-radius:22px!important;padding:22px 18px!important;margin-bottom:16px!important;box-shadow:0 14px 34px rgba(16,74,63,.12)!important}
  .hero h1{font-size:22px!important;line-height:1.35}
  .hero p{font-size:11px!important;line-height:1.7}
  .card{border-radius:19px!important;padding:17px!important;margin-bottom:14px!important;box-shadow:0 8px 24px rgba(25,66,55,.055)!important}
  .cols-4,.cols-3,.cols-2{grid-template-columns:1fr!important;gap:12px!important}
  .stat{min-height:0!important;padding:17px!important}
  .stat .value{font-size:27px!important}
  h1{font-size:22px} h2{font-size:16px!important}
  label{font-size:12px}
  input,select,textarea{font-size:16px!important;border-radius:12px!important;min-height:48px;padding:11px 12px!important;background:#fff}
  textarea{min-height:110px}
  .btn,button{min-height:44px;border-radius:12px;padding:10px 14px}
  .actions{gap:8px}
  .filters{padding:15px!important;grid-template-columns:1fr!important}
  .filters .actions{display:grid!important;grid-template-columns:1fr 1fr;width:100%}
  .filters .actions>*{width:100%;text-align:center}
  .table-wrap{margin-left:-4px;margin-right:-4px;border-radius:15px;background:#fff;box-shadow:0 8px 20px rgba(28,68,58,.04)}
  table{min-width:720px}
  th,td{padding:10px 9px!important;font-size:11px!important}
  .footer{display:none!important}

  .mobile-app-dock{position:fixed;display:grid;grid-template-columns:repeat(5,1fr);left:calc(10px + var(--safe-left));right:calc(10px + var(--safe-right));bottom:calc(8px + var(--safe-bottom));height:68px;padding:6px 5px;border:1px solid rgba(209,229,220,.92);border-radius:22px;background:rgba(255,255,255,.92);box-shadow:0 18px 45px rgba(18,64,52,.18);backdrop-filter:saturate(160%) blur(20px);-webkit-backdrop-filter:saturate(160%) blur(20px);z-index:55}
  .mobile-dock-item{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:100%;min-width:0;height:54px!important;min-height:54px!important;margin:0!important;padding:4px 2px!important;border:0!important;border-radius:16px!important;background:transparent!important;color:#6a7f78!important;text-decoration:none;font-family:inherit;font-weight:600;box-shadow:none!important}
  .mobile-dock-item .ui-icon{width:20px;height:20px;stroke-width:1.8}
  .mobile-dock-item span{font-size:9px;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  .mobile-dock-item.active{color:#087c69!important;background:linear-gradient(180deg,#e8f7f1,#f4fbf7)!important}
  .mobile-dock-item.active .ui-icon{filter:drop-shadow(0 3px 7px rgba(9,126,105,.15))}

  /* Login / unauthenticated pages: one polished app card, prominent logo. */
  body[data-page=login]{min-height:100dvh;background:radial-gradient(circle at 15% 0,#d8eee4 0,transparent 38%),linear-gradient(180deg,#eff6f1,#e9f0ec);padding:0}
  body[data-page=login] .auth-bg{min-height:100dvh!important;max-width:none!important;padding:calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(10px + var(--safe-left))!important;justify-content:flex-start!important}
  body[data-page=login] .auth-frame{width:min(100%,460px)!important;margin:0 auto!important;display:grid!important;grid-template-columns:1fr!important;border-radius:28px!important;box-shadow:0 24px 70px rgba(22,66,54,.16)!important;overflow:hidden!important}
  body[data-page=login] .auth-story{display:flex!important;min-height:220px!important;height:220px!important;padding:22px 22px 18px!important;border-radius:0!important}
  body[data-page=login] .auth-brand{font-size:11px!important;gap:9px}
  body[data-page=login] .auth-brand .brand-icon{width:36px!important;height:36px!important;border-radius:12px!important}
  body[data-page=login] .auth-brand small{font-size:8px!important}
  body[data-page=login] .auth-story-content{margin-top:16px!important}
  body[data-page=login] .auth-story .eyebrow{display:none}
  body[data-page=login] .auth-story h2{font-size:23px!important;line-height:1.35!important;max-width:67%!important;margin:4px 0 6px!important}
  body[data-page=login] .auth-story p{font-size:10px!important;line-height:1.6!important;max-width:62%!important;margin:0!important}
  body[data-page=login] .health-art{position:absolute!important;right:-42px!important;top:2px!important;width:220px!important;height:220px!important;margin:0!important;opacity:.92!important}
  body[data-page=login] .auth{padding:24px 22px 22px!important;background:linear-gradient(180deg,#fffefa,#fbfcf8)!important}
  body[data-page=login] .auth-logo-lockup{margin:0 0 20px!important;gap:12px!important}
  body[data-page=login] .auth-logo-lockup .auth-logo{display:grid!important;width:62px!important;height:62px!important;border-radius:19px!important}
  body[data-page=login] .auth-logo-copy strong{font-size:18px}
  body[data-page=login] .auth-logo-copy small{font-size:9px;margin-top:5px}
  body[data-page=login] .auth .card{padding:0!important;margin:0!important;background:transparent!important;border:0!important;box-shadow:none!important}
  body[data-page=login] .auth .eyebrow{font-size:8px!important}
  body[data-page=login] .auth h1{font-size:27px!important;margin-top:9px!important}
  body[data-page=login] .auth-intro{font-size:11px!important;margin:5px 0 20px!important}
  body[data-page=login] .login-form{gap:13px!important}
  body[data-page=login] .login-form input:not([type=hidden]){min-height:52px!important;border-radius:14px!important;font-size:16px!important}
  body[data-page=login] .login-submit>button{min-height:52px!important;border-radius:14px!important;font-size:14px!important}
  body[data-page=login] .login-register{margin-top:18px!important;padding-top:16px!important}
  body[data-page=login] .login-register>.btn{min-height:48px!important;border-radius:14px!important}
  body[data-page=login] .login-security{font-size:9px!important;margin-top:16px!important}
  body[data-page=login] .auth-bottom{font-size:9px!important;padding-top:18px!important}
  body[data-page=login] .auth-footer{font-size:8px!important;margin-top:13px!important;padding-bottom:4px}
}

@media(max-width:390px){
  .topbar-heading{max-width:calc(100vw - 180px)}
  .topbar-right>a[aria-label="คำขอเข้าใช้งาน"]{display:none!important}
  body[data-page=login] .auth-story{height:205px!important;min-height:205px!important}
  body[data-page=login] .auth-story h2{font-size:21px!important}
  body[data-page=login] .auth{padding:22px 18px 20px!important}
  body[data-page=login] .auth-logo-lockup .auth-logo{width:58px!important;height:58px!important}
  body[data-page=login] .auth-logo-copy strong{font-size:16px}
}

@media(display-mode:standalone) and (max-width:760px){
  .mobile-app-dock{bottom:calc(6px + var(--safe-bottom))}
}

@media print{
  .mobile-app-dock,.mobile-app-mark{display:none!important}
}
