/* Factory Talk — หน้าตาตามต้นแบบ 16 หน้า (สีอยู่ใน theme.css) */
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body { margin:0; height:100%; background:var(--bg); color:var(--text); font-family:"Prompt","Noto Sans Thai","Leelawadee UI",system-ui,sans-serif; font-size:16px; }
body { display:flex; justify-content:center; overflow:hidden; }
button, input, select, textarea { font:inherit; color:inherit; }
button { cursor:pointer; }
svg.i { width:24px; height:24px; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.hidden { display:none !important; }
html:not(.native) .native-only { display:none !important; }
html.native .web-only { display:none !important; }
:focus-visible { outline:3px solid var(--focus); outline-offset:2px; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.app { position:relative; width:100%; max-width:480px; height:100%; display:flex; flex-direction:column; background:var(--bg); overflow:hidden; }
#view { flex:1; display:flex; flex-direction:column; min-height:0; position:relative; }
.page { flex:1; display:flex; flex-direction:column; min-height:0; background:linear-gradient(180deg, var(--bg), var(--bg-2)); }
.scroll { flex:1; overflow:auto; min-height:0; }
.pad { padding:14px 14px 18px; }
.safe-top { padding-top:var(--safe-area-inset-top, env(safe-area-inset-top, 0px)); }
.safe-bottom { padding-bottom:var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)); }
.muted { color:var(--muted); } .small { font-size:13px; }
.row { display:flex; align-items:center; gap:10px; }
.grow { flex:1; min-width:0; }
.ell { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---------- navy page header (screens 04-16) ---------- */
.hd { background:linear-gradient(180deg, var(--head-a), var(--head-b)); color:var(--on-head); display:flex; align-items:center; gap:4px; padding:10px 8px 14px; position:relative; z-index:3; box-shadow:0 4px 14px rgba(5,25,70,.25); }
.hd h1 { flex:1; margin:0; font-size:21px; font-weight:600; min-width:0; }
.hd h1 small { display:flex; align-items:center; gap:6px; font-size:14px; font-weight:400; color:var(--head-muted); }
.ib { width:46px; height:46px; display:inline-flex; align-items:center; justify-content:center; border:0; border-radius:14px; background:transparent; color:inherit; position:relative; padding:0; flex:none; }
.ib svg.i { width:27px; height:27px; }
.badge { position:absolute; top:3px; right:2px; min-width:20px; height:20px; padding:0 5px; border-radius:10px; background:var(--badge); color:var(--on-badge); font-size:12px; font-weight:700; line-height:20px; text-align:center; border:2px solid var(--panel); }
.dot { display:inline-block; width:10px; height:10px; border-radius:50%; background:var(--nav-muted); flex:none; }
.dot.on { background:var(--ok-dot); } .dot.warn { background:#f59e0b; }

/* ---------- controls ---------- */
.btn { text-decoration:none; display:flex; align-items:center; justify-content:center; gap:10px; width:100%; min-height:54px; padding:10px 18px; border-radius:14px; font-size:18px; font-weight:600; border:var(--line-w) solid var(--line); background:var(--panel); color:var(--primary-fg); }
.btn.primary { background:linear-gradient(180deg, var(--primary-2), var(--primary)); border:0; color:var(--on-primary); box-shadow:0 6px 16px rgba(11,91,211,.3); }
.btn.accent { background:var(--accent); border:0; color:var(--on-accent); box-shadow:0 6px 16px rgba(196,74,0,.3); }
.btn.danger { background:linear-gradient(180deg, var(--t-sos-a), var(--t-sos-b)); border:0; color:var(--on-t-sos); }
.btn.sm { min-height:42px; font-size:15px; width:auto; padding:6px 14px; border-radius:12px; }
.btn svg.i { width:24px; height:24px; }
.card { background:var(--panel); border:1px solid var(--line-soft); border-radius:18px; box-shadow:var(--shadow); }
.field { position:relative; margin:12px 0; }
.field svg.i.lead { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--muted); }
.field input, .field select, .field textarea { width:100%; min-height:54px; padding:12px 16px 12px 48px; font-size:17px; border-radius:14px; border:var(--line-w) solid var(--line-soft); background:var(--field); color:var(--text); box-shadow:inset 0 1px 2px rgba(0,0,0,.04); }
.field.plain input, .field.plain select, .field.plain textarea { padding-left:16px; }
.field textarea { min-height:90px; resize:vertical; }
.field .trail { position:absolute; right:6px; top:50%; transform:translateY(-50%); color:var(--muted); }
label.lbl { display:block; font-size:14px; font-weight:600; color:var(--muted); margin:12px 2px -6px; }
.check { display:flex; align-items:center; gap:10px; font-size:16px; margin:6px 2px 14px; }
.check input { width:22px; height:22px; accent-color:var(--primary); margin:0; }
.err { color:var(--err-fg); font-size:14px; min-height:20px; margin:4px 2px; }
.tabs { display:flex; gap:8px; padding:12px 14px 6px; }
.tabs button { flex:1; min-height:42px; border-radius:12px; border:1px solid var(--line-soft); background:var(--panel); color:var(--text); font-weight:600; font-size:15px; padding:6px 8px; }
.tabs button.on { background:linear-gradient(180deg, var(--primary-2), var(--primary)); color:var(--on-primary); border-color:transparent; }
.tabs button.on-green { background:var(--t-grp-bg); color:var(--t-grp-fg); }
.search { margin:8px 14px; position:relative; }
.search input { width:100%; min-height:48px; border-radius:14px; border:1px solid var(--line-soft); background:var(--panel); padding:8px 14px 8px 46px; font-size:16px; }
.search svg.i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--muted); }
.list { margin:6px 14px 14px; background:var(--panel); border-radius:18px; border:1px solid var(--line-soft); overflow:hidden; box-shadow:var(--shadow); }
.li { display:flex; align-items:center; gap:12px; padding:12px 14px; border:0; border-bottom:1px solid var(--line-soft); width:100%; background:transparent; text-align:left; color:var(--text); }
.li:last-child { border-bottom:0; }
.li .t1 { font-weight:600; font-size:17px; } .li .t2 { font-size:14px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.li .chev { color:var(--primary-fg); }
.sec { font-size:15px; font-weight:600; color:var(--muted); margin:14px 18px 4px; display:flex; justify-content:space-between; align-items:center; }
.empty { text-align:center; color:var(--muted); padding:36px 24px; }
.pill { font-size:12px; font-weight:600; padding:3px 10px; border-radius:999px; white-space:nowrap; }
.pill.ok { background:var(--t-grp-bg); color:var(--t-grp-fg); } .pill.new { background:var(--badge); color:var(--on-badge); }
.pill.talk { background:var(--talk); color:var(--on-talk); } .pill.gray { background:var(--panel-2); color:var(--muted); }
.ic { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; flex:none; color:#fff; }
.ic svg.i { width:26px; height:26px; }
.ic.c-gold { background:#b58100; } .ic.c-green { background:#178a44; } .ic.c-yellow { background:#c27c00; } .ic.c-purple { background:#6d3fd8; }
.ic.c-orange { background:#d4520a; } .ic.c-blue { background:#1d63d6; } .ic.c-red { background:#cf2020; } .ic.c-teal { background:#0b7f80; } .ic.c-gray { background:#5b6880; }
.av { width:50px; height:50px; flex:none; border-radius:50%; overflow:hidden; background:#d7e6f8; box-shadow:0 0 0 2px var(--panel); }
.av img, .av svg { display:block; width:100%; height:100%; object-fit:cover; }
.sw { appearance:none; -webkit-appearance:none; width:54px; height:32px; border-radius:16px; background:var(--panel-2); border:var(--line-w) solid var(--line); position:relative; flex:none; margin:0; }
.sw::after { content:""; position:absolute; top:3px; left:3px; width:23px; height:23px; border-radius:50%; background:var(--muted); transition:left .15s; }
.sw:checked { background:var(--primary); border-color:var(--primary); }
.sw:checked::after { left:24px; background:var(--on-primary); }
.toast { position:absolute; left:16px; right:16px; bottom:calc(96px + var(--safe-area-inset-bottom, 0px)); background:var(--toast-bg); color:var(--toast-fg); border:2px solid var(--toast-line); padding:12px 16px; border-radius:16px; font-size:15px; z-index:80; text-align:center; box-shadow:var(--shadow); }
.fab { position:absolute; left:16px; right:16px; bottom:calc(16px + var(--safe-area-inset-bottom, 0px)); z-index:5; }

/* ---------- bottom nav (หน้าหลัก กลุ่ม [ไมค์] ข้อความ ตั้งค่า) ---------- */
.nav { display:flex; align-items:flex-end; background:var(--panel); box-shadow:0 -4px 16px rgba(16,58,130,.10); position:relative; z-index:4; padding-bottom:var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)); }
.nav button { flex:1; border:0; background:transparent; color:var(--nav-muted); display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 0 10px; font-size:13px; font-weight:500; position:relative; }
.nav button svg.i { width:27px; height:27px; }
.nav button.on { color:var(--primary-fg); font-weight:600; }
.nav .mic { flex:none; width:72px; height:72px; border-radius:50%; margin:-26px 4px 8px; background:linear-gradient(180deg, var(--primary-2), var(--primary)); color:var(--on-primary); box-shadow:0 0 0 6px var(--panel), 0 8px 18px rgba(11,91,211,.4); justify-content:center; padding:0; }
.nav .mic svg.i { width:34px; height:34px; }
.nav .badge { top:2px; right:calc(50% - 26px); }

/* ---------- 01 splash ---------- */
.splash { flex:1; position:relative; overflow:hidden; background:linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 45%, var(--sky-c) 70%); color:#fff; display:flex; flex-direction:column; align-items:center; }
.splash .scene { position:absolute; left:0; right:0; bottom:0; height:58%; }
.splash .scene svg { width:100%; height:100%; display:block; }
.appicon { width:118px; height:118px; border-radius:28px; background:linear-gradient(160deg, #2f86ff, #0a4fd0); display:flex; align-items:center; justify-content:center; box-shadow:0 10px 30px rgba(4,30,90,.35), inset 0 2px 0 rgba(255,255,255,.35); color:#fff; }
.appicon svg { width:72%; height:72%; }
.splash .appicon { margin-top:calc(70px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))); }
.wordmark { font-size:46px; font-weight:700; font-style:italic; letter-spacing:-.5px; margin-top:18px; text-shadow:0 3px 10px rgba(0,30,90,.35); }
.wordmark .t { color:#ffb347; }
.splash .tag { font-size:22px; font-weight:600; text-align:center; line-height:1.4; margin-top:10px; text-shadow:0 2px 8px rgba(0,30,90,.45); }
.splash .swoosh { position:absolute; left:-10%; right:-10%; bottom:44px; height:46px; background:linear-gradient(90deg, #ff8a00, #ffb347); border-radius:50% 50% 0 0 / 100% 100% 0 0; transform:rotate(-4deg); }
.splash .foot { position:absolute; left:0; right:0; bottom:0; background:linear-gradient(180deg, #0a3a8c, #072b6b); color:#fff; display:flex; align-items:center; justify-content:center; gap:10px; padding:14px 12px calc(14px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); font-size:17px; font-weight:600; }
.orglogo { height:34px; width:auto; display:block; }
.orglogo.light { filter:brightness(0) invert(1); }

/* ---------- 02 login ---------- */
.login { flex:1; overflow:auto; background:var(--panel); display:flex; flex-direction:column; align-items:center; padding:calc(36px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 24px 0; position:relative; }
.login .appicon { width:96px; height:96px; border-radius:24px; }
.login .name { font-size:32px; font-weight:700; color:var(--brand-fg); margin-top:12px; }
.login .name .t { color:var(--brand-talk); }
.login h2 { font-size:30px; font-weight:700; margin:8px 0 6px; color:var(--brand-fg); }
.login form { width:100%; max-width:400px; }
.login .skyline { width:100%; margin-top:auto; color:#cfe0f5; }
.login .skyline svg { display:block; width:100%; height:90px; }
.login .orgline { display:flex; align-items:center; gap:8px; justify-content:center; font-size:14px; color:var(--muted); margin:10px 0; }

/* ---------- 03 home ---------- */
.home-top { display:flex; align-items:center; gap:14px; padding:calc(16px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 16px 10px; }
.home-top .av { width:64px; height:64px; }
.home-top .hi { font-size:15px; color:var(--muted); }
.home-top .nm { font-size:22px; font-weight:700; line-height:1.15; }
.home-top .dp { font-size:15px; color:var(--muted); }
.home-top .ib { color:var(--primary-fg); }
.home-top .ib svg.i { width:30px; height:30px; }
.tiles6 { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:6px 14px; }
.tile { position:relative; min-height:118px; border-radius:20px; border:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; padding:12px 8px; font-weight:600; font-size:18px; text-align:center; box-shadow:var(--shadow); }
.tile svg.i { width:44px; height:44px; stroke-width:1.8; }
.tile small { display:block; font-size:14px; font-weight:500; }
.tile.wt { background:linear-gradient(160deg, var(--t-wt-a), var(--t-wt-b)); color:var(--on-t-wt); }
.tile.grp { background:var(--t-grp-bg); color:var(--text); } .tile.grp svg.i { color:var(--t-grp-fg); }
.tile.tmsg { background:linear-gradient(160deg, var(--t-msg-a), var(--t-msg-b)); color:var(--on-t-msg); }
.tile.sos { background:linear-gradient(160deg, var(--t-sos-a), var(--t-sos-b)); color:var(--on-t-sos); }
.tile.ttask { background:var(--t-task-bg); color:var(--text); } .tile.ttask svg.i { color:var(--t-task-fg); }
.tile.map { background:var(--t-map-bg); color:var(--text); } .tile.map svg.i { color:var(--t-map-fg); }
.tile .badge { top:8px; right:10px; }
.online-card { margin:12px 14px; display:flex; align-items:center; gap:14px; padding:14px 16px; }
.online-card .ic { background:var(--primary-soft); color:var(--primary-fg); }
.online-card b { font-size:17px; }

/* ---------- 04 push to talk ---------- */
.pttpage { flex:1; display:flex; flex-direction:column; min-height:0; color:var(--on-ptt-page); background:radial-gradient(120% 70% at 50% 40%, var(--ptt-page-a), var(--ptt-page-b)); }
.pttpage .hd { background:transparent; box-shadow:none; justify-content:center; }
.pttpage .hd h1 { text-align:center; }
.pttpage .lbl2 { text-align:center; color:var(--ptt-page-muted); font-size:16px; margin-top:2px; }
.chcard { margin:8px 18px 0; display:flex; align-items:center; gap:14px; padding:12px 14px; border-radius:18px; background:var(--ptt-card); border:1px solid rgba(255,255,255,.18); color:var(--on-ptt-page); width:calc(100% - 36px); text-align:left; }
.chcard .ic { width:52px; height:52px; background:rgba(255,255,255,.12); color:#9cc6ff; }
.chcard b { font-size:20px; display:block; }
.chcard small { color:var(--ptt-page-muted); font-size:15px; display:flex; align-items:center; gap:6px; }
.pttstage { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:10px 16px; }
.ptt { --s:min(66vw, 268px); width:var(--s); height:var(--s); border-radius:50%; border:0; touch-action:none; user-select:none; -webkit-user-select:none;
  background:radial-gradient(circle at 50% 30%, #ff9a3d 0%, var(--ptt-idle-a) 45%, var(--ptt-idle-b) 100%); color:var(--on-ptt);
  box-shadow:0 0 0 12px rgba(255,255,255,.08), 0 0 0 24px rgba(255,255,255,.04), 0 0 60px 10px color-mix(in srgb, var(--ptt-glow) 45%, transparent), inset 0 3px 0 rgba(255,255,255,.35), inset 0 -24px 40px rgba(0,0,0,.25);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; transition:transform .08s; }
.ptt svg.i { width:92px; height:92px; stroke-width:1.7; }
.ptt b { font-size:26px; font-weight:700; }
.ptt small { font-size:15px; }
.ptt.talking { background:radial-gradient(circle at 50% 30%, #ff4d5a 0%, var(--ptt-talk-a) 45%, var(--ptt-talk-b) 100%); transform:scale(.97); box-shadow:0 0 0 12px rgba(255,80,80,.18), 0 0 70px 14px rgba(255,40,40,.45), inset 0 -24px 40px rgba(0,0,0,.25); }
.ptt.listening { background:radial-gradient(circle at 50% 30%, #2bb36a 0%, var(--ptt-listen-a) 45%, var(--ptt-listen-b) 100%); box-shadow:0 0 0 12px rgba(80,220,140,.15), 0 0 70px 14px rgba(40,200,110,.4), inset 0 -24px 40px rgba(0,0,0,.25); }
.ptt.talking, .ptt.listening { animation:pulse 1.4s infinite; }
canvas.wave { width:100%; max-width:360px; height:70px; margin-top:26px; }
.pttstatus { display:flex; align-items:center; justify-content:center; gap:10px; font-size:18px; font-weight:500; padding:8px 0 22px; }
.pttstatus .dot { width:14px; height:14px; box-shadow:0 0 10px currentColor; }
.unlock { margin:0 18px 8px; }
@keyframes pulse { 50% { filter:brightness(1.1); } }

/* ---------- 06 chat ---------- */
.msgs { flex:1; overflow:auto; padding:14px 12px 8px; display:flex; flex-direction:column; gap:14px; min-height:0; }
.msg { display:flex; gap:10px; align-items:flex-start; }
.msg .av { width:46px; height:46px; }
.msg .body { flex:1; min-width:0; }
.msg .who { display:flex; justify-content:space-between; gap:8px; font-size:15px; font-weight:600; color:var(--text); margin:0 2px 4px; }
.msg .who time { font-weight:400; color:var(--muted); font-size:14px; flex:none; }
.bubble { display:inline-block; max-width:100%; background:var(--other-bg); color:var(--text); padding:10px 14px; border-radius:16px; border-top-left-radius:6px; font-size:17px; line-height:1.5; white-space:pre-wrap; word-break:break-word; border:0; text-align:left; }
.msg.mine { justify-content:flex-end; }
.msg.mine .body { flex:none; max-width:78%; text-align:right; }
.msg.mine .bubble { background:var(--mine-bg); border-top-left-radius:16px; border-top-right-radius:6px; }
.msg.mine .who { justify-content:flex-end; }
.voice { display:flex; align-items:center; gap:10px; background:var(--other-bg); border-radius:16px; padding:8px 14px 8px 8px; min-width:220px; max-width:100%; border:0; color:var(--text); }
.msg.mine .voice { background:var(--mine-bg); margin-left:auto; }
.voice .play { width:40px; height:40px; border-radius:50%; background:linear-gradient(180deg, var(--primary-2), var(--primary)); color:var(--on-primary); display:flex; align-items:center; justify-content:center; flex:none; }
.voice .play svg.i { width:22px; height:22px; }
.voice .bars { flex:1; height:26px; display:flex; align-items:center; gap:2px; }
.voice .bars i { flex:1; background:var(--primary); border-radius:2px; opacity:.85; }
.voice .bars i.done { background:var(--talk-fg); }
.voice .dur { font-size:14px; color:var(--muted); font-variant-numeric:tabular-nums; }
.voice.noaudio .play { background:var(--panel-2); color:var(--muted); }
.reacts { display:flex; gap:6px; flex-wrap:wrap; margin-top:4px; }
.msg.mine .reacts { justify-content:flex-end; }
.react { border:1px solid var(--line-soft); background:var(--panel); border-radius:999px; padding:2px 10px; font-size:15px; color:var(--text); }
.react.me { border:2px solid var(--primary); }
.sys { align-self:center; font-size:13px; color:var(--muted); text-align:center; }
.composer { display:flex; gap:8px; align-items:center; padding:8px 10px calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); background:var(--panel); border-top:1px solid var(--line-soft); }
.composer input { flex:1; min-width:0; min-height:48px; border-radius:999px; border:1px solid var(--line-soft); padding:8px 18px; background:var(--panel-2); font-size:17px; }
.composer .go { width:52px; height:52px; border-radius:50%; border:0; background:linear-gradient(180deg, var(--primary-2), var(--primary)); color:var(--on-primary); display:flex; align-items:center; justify-content:center; flex:none; touch-action:none; user-select:none; -webkit-user-select:none; }
.composer .go.talking { background:var(--talk); color:var(--on-talk); }
.composer .go.listening { background:var(--listen); color:var(--on-listen); }
.composer .go svg.i { width:26px; height:26px; }

/* ---------- 08 history ---------- */
.hrow { display:flex; align-items:center; gap:12px; padding:12px 14px; background:var(--panel); border:1px solid var(--line-soft); border-radius:16px; margin:8px 14px; box-shadow:var(--shadow); }
.hrow .ic { background:var(--primary-soft); color:var(--primary-fg); width:42px; height:42px; }
.hrow .t1 { font-weight:600; } .hrow .t2 { font-size:14px; color:var(--muted); }
.playbtn { width:44px; height:44px; border-radius:50%; border:0; background:linear-gradient(180deg, var(--primary-2), var(--primary)); color:var(--on-primary); display:flex; align-items:center; justify-content:center; flex:none; }
.playbtn svg.i { width:22px; height:22px; }
.playbtn:disabled { background:var(--panel-2); color:var(--muted); }

/* ---------- 09 map ---------- */
.mapwrap { flex:1; position:relative; overflow:auto; min-height:0; background:#bfd9a8; touch-action:pan-x pan-y; }
.mapinner { position:relative; width:100%; transform-origin:0 0; }
.mapinner > img, .mapinner > svg { display:block; width:100%; height:auto; user-select:none; -webkit-user-drag:none; }
.pin { position:absolute; transform:translate(-50%, -50%); display:flex; align-items:center; gap:6px; background:var(--panel); color:var(--text); border:0; border-radius:999px; padding:4px 12px 4px 4px; font-size:15px; font-weight:600; box-shadow:0 4px 12px rgba(0,0,0,.25); white-space:nowrap; touch-action:none; }
.pin .ic { width:32px; height:32px; border-radius:50%; }
.pin .ic svg.i { width:19px; height:19px; }
.pin.sos { animation:sosblink 1s infinite; outline:3px solid var(--talk); }
.mapzoom { position:absolute; right:12px; bottom:calc(16px + var(--safe-area-inset-bottom, 0px)); display:flex; flex-direction:column; background:var(--panel); border-radius:14px; box-shadow:var(--shadow); overflow:hidden; z-index:3; }
.mapzoom button { width:50px; height:50px; border:0; background:transparent; font-size:28px; color:var(--text); }
.mapzoom button + button { border-top:1px solid var(--line-soft); }
.mapbar { position:absolute; left:12px; top:12px; z-index:3; display:flex; gap:8px; flex-wrap:wrap; }

/* ---------- 10 tasks ---------- */
.task { display:flex; align-items:flex-start; gap:12px; padding:14px; background:var(--panel); border:1px solid var(--line-soft); border-radius:16px; margin:8px 14px; box-shadow:var(--shadow); }
.task input { width:26px; height:26px; margin:2px 0 0; accent-color:var(--ok-dot); flex:none; }
.task .t1 { font-weight:600; font-size:17px; }
.task .due { font-size:14px; color:var(--err-fg); }
.task.done .due { color:var(--ok-fg); }
.task.done .t1 { color:var(--muted); }

/* ---------- 11 SOS ---------- */
.sospage { flex:1; overflow:auto; background:var(--bg); }
.soshead { background:linear-gradient(180deg, var(--t-sos-a), var(--t-sos-b)); color:#fff; padding:calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 8px 26px; border-radius:0 0 28px 28px; text-align:center; position:relative; }
.soshead h1 { margin:6px 0 0; font-size:28px; font-weight:700; }
.soshead .siren { width:96px; height:96px; margin:14px auto 6px; color:#fff; }
.soshead .back { position:absolute; left:8px; top:calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))); color:#fff; }
.sosbig { margin:-20px 22px 0; position:relative; z-index:2; min-height:66px; font-size:22px; border-radius:999px; background:#fff; color:#c81e1e; border:3px solid #c81e1e; box-shadow:0 8px 20px rgba(200,30,30,.35); font-weight:700; }
.sosgrid { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:18px 14px; }
.sostile { min-height:112px; border-radius:18px; background:var(--panel); border:2px solid var(--line-soft); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; font-weight:600; font-size:16px; color:var(--text); box-shadow:var(--shadow); text-align:center; padding:8px; }
.sostile svg.i { width:44px; height:44px; }
.sostile.on { border-color:var(--talk); background:color-mix(in srgb, var(--talk) 10%, var(--panel)); }
.sos-alert { position:absolute; inset:0; z-index:90; background:#b40f0f; color:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:24px; animation:sosbg 1s infinite; }
.sos-alert h2 { font-size:30px; margin:12px 0 6px; }
.sos-alert p { font-size:18px; margin:4px 0; }
.sos-alert .btn { margin-top:14px; max-width:340px; }
.sos-alert .btn.ack { background:#fff; color:#b40f0f; border:0; }
.sos-alert .btn.ghost { background:transparent; color:#fff; border:2px solid #fff; }
@keyframes sosbg { 50% { background:#e01b1b; } }
@keyframes sosblink { 50% { transform:translate(-50%, -50%) scale(1.08); } }

/* ---------- 12-16 ---------- */
.ntf .ic { width:44px; height:44px; border-radius:50%; }
.prof { text-align:center; padding:22px 16px 6px; }
.prof .bigav { width:120px; height:120px; margin:0 auto; position:relative; }
.prof .bigav .av { width:120px; height:120px; box-shadow:0 0 0 4px var(--panel), var(--shadow); }
.prof .cam { position:absolute; right:-2px; bottom:4px; width:40px; height:40px; border-radius:50%; border:3px solid var(--panel); background:var(--primary); color:var(--on-primary); display:flex; align-items:center; justify-content:center; }
.prof .cam svg.i { width:20px; height:20px; }
.prof h2 { font-size:26px; margin:12px 0 2px; }
.kv .ic { background:var(--primary-soft); color:var(--primary-fg); }
.kv .t1 { font-size:14px; font-weight:500; color:var(--muted); } .kv .t2 { font-size:17px; color:var(--text); font-weight:600; }
.setrow { display:flex; align-items:center; gap:14px; padding:16px; border-bottom:1px solid var(--line-soft); }
.setrow:last-child { border-bottom:0; }
.setrow svg.i.lead { width:28px; height:28px; color:var(--primary-fg); }
.setrow b { font-size:17px; font-weight:600; display:block; } .setrow small { color:var(--muted); font-size:13px; display:block; }
input[type=range] { width:100%; accent-color:var(--accent); height:28px; }
.stat4 { display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; padding:14px 14px 4px; }
.stat { border-radius:14px; background:var(--panel); border:1px solid var(--line-soft); padding:10px 4px; text-align:center; box-shadow:var(--shadow); }
.stat svg.i { width:30px; height:30px; color:var(--primary-fg); }
.stat b { display:block; font-size:24px; line-height:1.2; }
.stat small { font-size:12px; color:var(--muted); display:block; line-height:1.25; }
.stat.green { background:var(--t-grp-bg); } .stat.green svg.i { color:var(--t-grp-fg); }
.barrow { display:grid; grid-template-columns:108px 1fr 42px; align-items:center; gap:10px; padding:7px 0; font-size:15px; }
.barrow .bar { height:16px; border-radius:8px; background:var(--panel-2); overflow:hidden; }
.barrow .bar i { display:block; height:100%; border-radius:8px; background:linear-gradient(90deg, var(--primary), var(--primary-2)); }
.barrow b { text-align:right; }
.admtabs { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; padding:12px 14px 6px; }
.admtabs button { min-height:70px; border-radius:14px; border:1px solid var(--line-soft); background:var(--panel); color:var(--primary-fg); font-weight:600; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.admtabs button.on { background:linear-gradient(180deg, var(--primary-2), var(--primary)); color:var(--on-primary); border-color:transparent; }

/* ---------- sheets / dialogs ---------- */
.sheet-bg { position:absolute; inset:0; background:rgba(4,12,30,.5); z-index:60; display:flex; align-items:flex-end; }
.sheet { width:100%; max-height:88%; overflow:auto; background:var(--panel); border-radius:24px 24px 0 0; padding:8px 18px calc(18px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); box-shadow:0 -10px 30px rgba(0,0,0,.25); }
.sheet .grab { width:44px; height:5px; border-radius:3px; background:var(--line-soft); margin:4px auto 10px; }
.sheet h3 { font-size:20px; margin:4px 0 8px; }
.qr { background:#fff; padding:12px; border-radius:12px; width:240px; margin:8px auto; }
.qr svg { display:block; width:100%; height:auto; }
video.scan { width:100%; border-radius:12px; background:#000; aspect-ratio:1; object-fit:cover; }
.chips { display:flex; gap:8px; flex-wrap:wrap; margin:8px 0; }
.chips button { border:1px solid var(--line-soft); border-radius:999px; background:var(--panel); padding:6px 12px; color:var(--text); }
.chips button.on { background:var(--primary); color:var(--on-primary); border-color:var(--primary); }
.picker { display:flex; justify-content:space-around; padding:6px 0 4px; }
.picker button { font-size:32px; border:0; background:transparent; padding:6px; border-radius:12px; }
.picker button.me { background:var(--primary-soft); }
@media (prefers-reduced-motion: reduce) { .ptt, .sos-alert, .pin.sos { animation:none !important; } }
@media (max-height:700px) { .ptt { --s:min(56vw, 220px); } .tile { min-height:96px; } .tile svg.i { width:36px; height:36px; } }
/* company logo (brand/logo.png) */
.splash .foot .orglogo { height:46px; }
.login .orgline { flex-direction:column; gap:4px; margin-top:16px; }
.login .orgline .orglogo { height:52px; }

/* WORMADI brand images */
.appicon-img { display:block; width:118px; height:118px; border-radius:26px; box-shadow:0 10px 30px rgba(4,30,90,.35); }
.splash .appicon-img { margin-top:calc(64px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))); }
.login .appicon-img { width:92px; height:92px; border-radius:22px; }
.wordmark-img { display:block; width:min(78%, 300px); height:auto; margin:10px auto 2px; }
.splash .tag small { font-size:16px; font-weight:500; opacity:.95; }

/* install to home screen */
.install-bar { display:flex; align-items:center; gap:10px; margin:10px 14px 4px; padding:10px 10px 10px 12px; border-radius:16px; background:var(--panel); border:var(--line-w) solid var(--line); box-shadow:0 4px 14px rgba(11,58,140,.10); text-align:left; }
.install-bar img { width:44px; height:44px; border-radius:11px; flex:none; }
.install-bar b { display:block; font-size:15px; color:var(--text); }
.install-bar small { display:block; font-size:13px; color:var(--muted); line-height:1.35; }
.install-bar .btn { flex:none; }
.install-bar .ib { flex:none; width:38px; height:38px; color:var(--muted); }
.login .install-bar { margin:0; }

/* one-press SOS */
.sosone { display:flex; flex-direction:column; align-items:center; gap:14px; padding:22px 0 6px; }
.sosring { position:relative; width:210px; height:210px; border-radius:50%; border:0; padding:0; overflow:hidden; cursor:pointer;
  background:radial-gradient(circle at 50% 40%, #ef3b3b, #b31212); color:#fff; box-shadow:0 0 0 10px rgba(216,30,30,.16), 0 14px 30px rgba(180,18,18,.45);
  touch-action:none; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
.sosring .fill { position:absolute; inset:0; border-radius:50%; background:rgba(255,255,255,.28); transform:scale(0); }
.sosring .in { position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; gap:2px; }
.sosring svg.i { width:70px; height:70px; }
.sosring b { font-size:28px; }
.sosring small { font-size:15px; opacity:.95; }
.sosring.hold { box-shadow:0 0 0 18px rgba(216,30,30,.25), 0 14px 30px rgba(180,18,18,.5); }
.sosring.sent { background:radial-gradient(circle at 50% 40%, #2e9e52, #17703a); box-shadow:0 0 0 10px rgba(30,140,70,.18); }
.sosme { text-align:center; font-size:15px; color:var(--text); line-height:1.6; padding:0 16px; }
.sosme svg.i { width:16px; height:16px; vertical-align:-3px; }

/* real map (Leaflet + phone GPS) */
.gmap { flex:1; min-height:320px; position:relative; z-index:0; background:var(--panel-2); }
.gmapbar { display:flex; gap:8px; flex-wrap:wrap; padding:10px 14px 0; }
.gmapinfo { padding:8px 14px 12px; font-size:14px; color:var(--muted); line-height:1.6; min-height:20px; }
.gmapinfo .chip { border:var(--line-w) solid var(--line); background:var(--panel); color:var(--text); border-radius:999px; padding:4px 12px; font:inherit; margin:2px; cursor:pointer; }
#mapEdit.on { background:var(--primary); color:var(--on-primary); border-radius:12px; }
.gpin-wrap { background:none; border:0; }
.gpin { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; background:#fff; color:#0b1f3a; font:600 14px/1 inherit; font-family:inherit;
  padding:3px 12px 3px 3px; border-radius:999px; box-shadow:0 3px 10px rgba(0,0,0,.3); }
.gpin .ic { width:30px; height:30px; border-radius:50%; display:grid; place-items:center; color:#fff; flex:none; }
.gpin .ic svg { width:17px; height:17px; }
.gpin.sos { background:#d81e1e; color:#fff; animation:sospulse 1.2s infinite; }
@keyframes sospulse { 50% { box-shadow:0 0 0 10px rgba(216,30,30,.25); } }
.gme { display:block; width:22px; height:22px; border-radius:50%; background:#1d63d6; border:4px solid #fff; box-shadow:0 0 0 2px rgba(29,99,214,.4), 0 2px 6px rgba(0,0,0,.4); }
.leaflet-container { font-family:inherit; }
