/* SSB Design System (เขียวปาล์ม) — หน้า LIFF มือถือ */
:root{
  --bg:#f5f5f7;--surface:#ffffff;--subtle:#f5f5f7;--hover:#e8e8ed;--border:#d2d2d7;--border-s:#e8e8ed;
  --text:#1d1d1f;--text2:#6e6e73;--text3:#86868b;
  --accent:#1a7d4c;--accent-h:#146340;--accent-soft:#eff8f3;--on-accent:#ffffff;
  --ok:#1a7d4c;--ok-bg:#eff8f3;--warn:#b25000;--warn-bg:#fdf1e7;--danger:#c8102e;--danger-bg:#fdecef;--info:#0071e3;--info-bg:#e9f2fd;
  --line:#06c755;--scrim:rgba(0,0,0,.45);--skhl:#ececf0;
  --sh-sm:0 1px 2px rgba(0,0,0,.05);--sh-md:0 4px 16px rgba(0,0,0,.06);--sh-lg:0 12px 40px rgba(0,0,0,.10);
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Text","Inter","Noto Sans Thai","Sarabun","Segoe UI",Roboto,sans-serif;
  --ease:cubic-bezier(.25,.1,.25,1);
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root{
  --bg:#000000;--surface:#1c1c1e;--subtle:#2c2c2e;--hover:#3a3a3c;--border:#3a3a3c;--border-s:#2c2c2e;
  --text:#f5f5f7;--text2:#a1a1a6;--text3:#86868b;
  --accent:#4cc38a;--accent-h:#6fd3a2;--accent-soft:#10291c;--on-accent:#042315;
  --ok:#4cc38a;--ok-bg:#10291c;--warn:#ffb340;--warn-bg:#2e2010;--danger:#ff6961;--danger-bg:#331414;--info:#64d2ff;--info-bg:#0f2433;
  --skhl:#3a3a3c;color-scheme:dark}}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0}
[hidden]{display:none!important}
body{background:var(--bg);color:var(--text);font-family:var(--font);font-size:16px;line-height:1.6;min-height:100vh}
h1,h2,h3{margin:0;line-height:1.3;font-weight:600}
p{margin:0}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
svg.i{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.num{font-variant-numeric:tabular-nums}

.app{max-width:560px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column}
.bar{position:sticky;top:0;z-index:10;display:flex;align-items:center;gap:8px;padding:6px 12px;padding-top:calc(6px + env(safe-area-inset-top,0px));min-height:52px;
  background:color-mix(in srgb,var(--surface) 86%,transparent);backdrop-filter:saturate(180%) blur(20px);-webkit-backdrop-filter:saturate(180%) blur(20px);border-bottom:1px solid var(--border-s)}
.bar .back{border:0;background:none;width:40px;height:40px;border-radius:10px;display:grid;place-items:center;color:var(--accent)}
.bar .ttl{flex:1;min-width:0;font-weight:600;font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.main{flex:1;padding:16px;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:16px}
.main.in{animation:in .28s var(--ease)}
@keyframes in{from{opacity:.4;transform:translateY(6px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.main.in{animation:none}*{transition:none!important}}

.hello{display:flex;align-items:center;gap:12px}
.avatar{width:44px;height:44px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;font-weight:600;flex:none;overflow:hidden}
.avatar img{width:100%;height:100%;object-fit:cover}
.avatar.sm{width:36px;height:36px;font-size:13px}
.hello b{display:block;font-size:17px;font-weight:600;line-height:1.3}
.hello small{color:var(--text2);font-size:13px}
.card{background:var(--surface);border:1px solid var(--border-s);border-radius:18px;padding:16px;box-shadow:var(--sh-sm)}
.todo{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;text-align:center}
.todo b{display:block;font-size:26px;font-weight:600;line-height:1.2}
.todo span{font-size:12px;color:var(--text2)}
.todo .warn b{color:var(--warn)}.todo .danger b{color:var(--danger)}
.group-h{font-size:13px;color:var(--text2);font-weight:600;margin:4px 2px -8px}
.tiles{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.tile{display:flex;flex-direction:column;gap:8px;text-align:left;background:var(--surface);border:1px solid var(--border-s);border-radius:16px;padding:14px;min-height:96px;position:relative;transition:box-shadow .16s var(--ease),transform .16s var(--ease)}
.tile:active{transform:scale(.98)}
.tile .ic{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent)}
.tile b{font-size:15px;font-weight:600;line-height:1.3}
.tile small{font-size:12px;color:var(--text3);line-height:1.35}
.tile.soon{opacity:.6}
.tile .badge{position:absolute;top:10px;right:10px;min-width:22px;height:22px;border-radius:980px;background:var(--danger);color:#fff;font-size:12px;font-weight:600;display:grid;place-items:center;padding:0 6px}
.tile.wide{grid-column:1/-1;flex-direction:row;align-items:center;min-height:0;background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.tile.wide .ic{background:rgba(255,255,255,.18);color:var(--on-accent)}
.tile.wide small{color:inherit;opacity:.85}
.sites{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.tile.site{min-height:150px;justify-content:space-between;padding:16px;gap:10px}
.tile.site .ic{width:48px;height:48px;border-radius:14px}
.tile.site b{font-size:19px}
.tile.site.cur{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent) inset}
.tile.site .last{min-height:18px;font-size:11px;color:var(--accent);font-weight:600}
.sitebar{display:flex;align-items:center;gap:10px;background:var(--surface);border:1px solid var(--border-s);border-radius:14px;padding:8px 8px 8px 12px;font-size:14px}
.sitebar .ic{color:var(--accent);display:grid}
.sitebar span{flex:1;min-width:0}
.sitebar b{font-weight:600}
.sitebar button{border:1px solid var(--border);background:var(--surface);border-radius:980px;height:34px;padding:0 14px;font-size:13px;color:var(--accent)}

label.f{display:block;font-size:13px;font-weight:600;color:var(--text2);margin-bottom:6px}
.req{color:var(--danger)}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{height:36px;padding:0 14px;border-radius:980px;border:1px solid var(--border);background:var(--surface);font-size:14px;display:inline-flex;align-items:center;gap:6px}
.chip[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.chip .c{opacity:.65;font-size:12px}
select,textarea,input[type=text],input[type=date]{width:100%;font:inherit;font-size:16px;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 12px;min-height:46px}
select:focus,textarea:focus,input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 4px rgba(26,125,76,.28)}
textarea{min-height:90px;resize:vertical}
.seg{display:grid;grid-template-columns:repeat(3,1fr);background:var(--subtle);border-radius:12px;padding:3px;gap:3px}
.seg button{border:0;background:none;border-radius:9px;height:40px;font-size:14px;font-weight:500;color:var(--text2)}
.seg button[aria-pressed="true"]{background:var(--surface);box-shadow:var(--sh-sm);color:var(--text)}
.seg button[aria-pressed="true"][data-v="สูง"]{color:var(--danger)}
.seg button[aria-pressed="true"][data-v="กลาง"]{color:var(--warn)}
.seg button[aria-pressed="true"][data-v="ต่ำ"]{color:var(--ok)}
.hint{font-size:12px;color:var(--text3);margin-top:6px}

.photos{display:flex;gap:8px;flex-wrap:wrap}
.ph{width:78px;height:78px;border-radius:12px;background:var(--subtle) center/cover no-repeat;position:relative;flex:none;border:1px solid var(--border-s)}
.ph .x{position:absolute;top:-6px;right:-6px;width:24px;height:24px;border-radius:50%;border:0;background:var(--text);color:var(--bg);font-size:13px;line-height:1;display:grid;place-items:center}
.ph-add{width:78px;height:78px;border-radius:12px;border:1.5px dashed var(--border);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:var(--text3);background:var(--surface);font-size:11px;text-align:center;line-height:1.2;cursor:pointer}
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:8px}
.gallery a{display:block;aspect-ratio:1;border-radius:12px;background:var(--subtle) center/cover no-repeat;max-width:100%}

.sups{display:flex;flex-direction:column;gap:8px}
.sup{display:flex;align-items:center;gap:10px;text-align:left;width:100%;min-height:56px;padding:8px 12px;border-radius:14px;border:1px solid var(--border);background:var(--surface)}
.sup[aria-pressed="true"]{border-color:var(--accent);background:var(--accent-soft);box-shadow:0 0 0 1px var(--accent) inset}
.sup .who{flex:1;min-width:0;line-height:1.3}
.sup .who b{display:block;font-size:15px;font-weight:600}
.sup .who small{font-size:12px;color:var(--text3)}
.lb{font-size:11px;font-weight:600;color:#fff;background:var(--line);border-radius:6px;padding:1px 6px;flex:none}
.tick{width:22px;height:22px;border-radius:50%;border:1.5px solid var(--border);display:grid;place-items:center;flex:none}
.sup[aria-pressed="true"] .tick{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.tick svg{width:13px;height:13px;stroke-width:3}
.empty{font-size:14px;color:var(--text2);background:var(--warn-bg);border-left:3px solid var(--warn);border-radius:12px;padding:10px 12px}
.route{display:flex;flex-direction:column;gap:8px;font-size:14px}
.route>div{display:flex;gap:10px;align-items:center}
.route .dot{width:28px;height:28px;border-radius:50%;background:var(--subtle);display:grid;place-items:center;flex:none;color:var(--text2)}
.route .dot svg{width:16px;height:16px}
.route small{color:var(--text3);display:block;font-size:12px;line-height:1.3}

.btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:48px;border-radius:980px;border:0;font-weight:500;font-size:16px;padding:0 18px}
.btn-primary{background:var(--accent);color:var(--on-accent)}
.btn-primary:disabled{opacity:.55}
.btn-sec{background:var(--surface);border:1px solid var(--accent);color:var(--accent)}
.btn-danger{background:var(--danger);color:#fff}
.btn-ghost{background:var(--subtle);color:var(--text)}
.btn-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.foot{position:sticky;bottom:0;background:linear-gradient(to top,var(--bg) 72%,transparent);padding:14px 0 calc(4px + env(safe-area-inset-bottom,0px));margin-top:-4px;display:flex;flex-direction:column;gap:10px}

.pill{display:inline-flex;align-items:center;gap:6px;border-radius:980px;padding:1px 10px;font-size:12px;font-weight:500;white-space:nowrap}
.pill::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.p-ok{background:var(--ok-bg);color:var(--ok)}.p-warn{background:var(--warn-bg);color:var(--warn)}
.p-danger{background:var(--danger-bg);color:var(--danger)}.p-info{background:var(--info-bg);color:var(--info)}
.p-mute{background:var(--subtle);color:var(--text2)}
.tabs{display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--border-s)}
.tabs button{border:0;background:none;height:42px;font-size:15px;color:var(--text2);border-bottom:2px solid transparent}
.tabs button[aria-pressed="true"]{color:var(--text);font-weight:600;border-color:var(--accent)}
.item{display:flex;gap:12px;text-align:left;width:100%;background:var(--surface);border:1px solid var(--border-s);border-radius:16px;padding:12px}
.item .ph{width:64px;height:64px}
.item .body{min-width:0;flex:1;display:flex;flex-direction:column;gap:3px}
.item b{font-size:15px;font-weight:600;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.item .meta{font-size:12px;color:var(--text3)}
.row{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.kv{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;font-size:14px;margin:0}
.kv dt{color:var(--text3)}.kv dd{margin:0;min-width:0;overflow-wrap:anywhere}
.tl{list-style:none;margin:0;padding:0}
.tl li{display:grid;grid-template-columns:24px 1fr;gap:10px;position:relative;padding-bottom:14px;font-size:14px}
.tl li::before{content:"";position:absolute;left:11px;top:22px;bottom:0;width:2px;background:var(--border-s)}
.tl li:last-child::before{display:none}
.tl .n{width:24px;height:24px;border-radius:50%;background:var(--accent);color:var(--on-accent);display:grid;place-items:center}
.tl .n svg{width:13px;height:13px;stroke-width:3}
.tl b{font-weight:600;display:block;line-height:1.35}
.tl small{color:var(--text3);font-size:12px}
.tl .note{font-size:13px;color:var(--text2);background:var(--subtle);border-radius:10px;padding:6px 10px;margin-top:4px}
.pend{background:var(--subtle);border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:10px}

.center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;padding:40px 20px;color:var(--text2)}
.center h2{color:var(--text);font-size:20px}
.ldr-ring{width:56px;height:56px;border-radius:50%;background:conic-gradient(from 0deg,transparent 15%,var(--accent));
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 5px),#000 calc(100% - 4px));mask:radial-gradient(farthest-side,transparent calc(100% - 5px),#000 calc(100% - 4px));animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.sk{border-radius:12px;background:linear-gradient(100deg,var(--subtle) 40%,var(--skhl) 50%,var(--subtle) 60%);background-size:200% 100%;animation:skm 1.3s linear infinite}
@keyframes skm{to{background-position:-200% 0}}

.toast{position:fixed;left:50%;bottom:calc(28px + env(safe-area-inset-bottom,0px));transform:translate(-50%,20px);background:var(--text);color:var(--bg);padding:10px 18px;border-radius:980px;font-size:14px;opacity:0;pointer-events:none;transition:all .28s var(--ease);z-index:50;max-width:calc(100% - 32px);text-align:center}
.toast.show{opacity:1;transform:translate(-50%,0)}
.modal{position:fixed;inset:0;background:var(--scrim);display:grid;place-items:center;z-index:40;padding:16px}
.modal .box{background:var(--surface);border-radius:24px;padding:24px;width:100%;max-width:400px;box-shadow:var(--sh-lg);display:flex;flex-direction:column;gap:14px}
.modal h3{font-size:18px}
.modal p{color:var(--text2);font-size:15px}
.build{font-size:11px;color:var(--text3);text-align:center;border:0;background:none;padding:8px}
.busy{position:fixed;inset:0;background:color-mix(in srgb,var(--bg) 60%,transparent);display:grid;place-items:center;z-index:45}
