@font-face{font-family:'Prompt';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/p-thai-400.woff2) format('woff2');unicode-range:U+0E01-0E5B,U+200B-200D,U+25CC}
@font-face{font-family:'Prompt';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/p-latin-400.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Prompt';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/p-thai-500.woff2) format('woff2');unicode-range:U+0E01-0E5B,U+200B-200D,U+25CC}
@font-face{font-family:'Prompt';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/p-latin-500.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Prompt';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/p-thai-600.woff2) format('woff2');unicode-range:U+0E01-0E5B,U+200B-200D,U+25CC}
@font-face{font-family:'Prompt';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/p-latin-600.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Prompt';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/p-thai-700.woff2) format('woff2');unicode-range:U+0E01-0E5B,U+200B-200D,U+25CC}
@font-face{font-family:'Prompt';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/p-latin-700.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Noto Sans Myanmar';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/m-400.woff2) format('woff2');unicode-range:U+1000-109F,U+200C-200D,U+25CC,U+A9E0-A9FF,U+AA60-AA7F}
@font-face{font-family:'Noto Sans Myanmar';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/m-600.woff2) format('woff2');unicode-range:U+1000-109F,U+200C-200D,U+25CC,U+A9E0-A9FF,U+AA60-AA7F}
@font-face{font-family:'Noto Sans Myanmar';font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/m-700.woff2) format('woff2');unicode-range:U+1000-109F,U+200C-200D,U+25CC,U+A9E0-A9FF,U+AA60-AA7F}
/* แซ่บไทม์ — สีจากโลโก้: กรมท่ายามค่ำ, เหลืองตะวัน, แดงกุ้ง, ฟ้าน้ำทะเล */
:root {
  --ink: #161a3d;
  --ink-2: #4a5078;
  --ink-3: #7b819f;
  --night: #161a3d;
  --sun: #f5e11a;
  --shrimp: #e8312f;
  --sky: #1da1dc;
  --paper: #f3f6fb;
  --card: #ffffff;
  --seg: #e6ebf5; --chipbg: #eef1f8; --soft: #eaeefa; --note: #fff8d6; --mark: #161a3d;
  --line: #dde3ee;
  --ok: #17935b;
  --warn: #c76a00;
  --r-card: 18px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: 'Prompt', 'Noto Sans Myanmar', 'Myanmar Text', 'Padauk', 'Sukhumvit Set', 'Noto Sans Thai', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); }
body { min-height: 100dvh; font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: calc(16px + var(--safe-t)) 16px calc(var(--tab-h) + var(--safe-b) + 28px); }
.screen.no-tabs { padding-bottom: calc(28px + var(--safe-b)); }

/* ---------- ท้องฟ้า (หัวหน้าแรก) ---------- */
.sky {
  --a: #1da1dc; --b: #7fd0f0;
  position: relative; overflow: hidden; color: #fff;
  border-radius: 0 0 28px 28px;
  margin: calc(-16px - var(--safe-t)) -16px 18px;
  padding: calc(22px + var(--safe-t)) 20px 22px;
  background: linear-gradient(180deg, var(--a), var(--b));
  isolation: isolate;
}
.sky::before { /* รัศมีตะวันจากขอบล่าง เหมือนในโลโก้ */
  content: ''; position: absolute; left: 50%; bottom: -150px; width: 420px; height: 420px; margin-left: -210px; z-index: -1;
  background: repeating-conic-gradient(from -90deg at 50% 50%, rgba(245, 225, 26, .55) 0 6deg, transparent 6deg 12deg);
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 70%); mask-image: radial-gradient(circle, #000 25%, transparent 70%);
  opacity: 0; transition: opacity .6s;
}
.sky.dawn { --a: #3b6fb0; --b: #f2a65a; }
.sky.dawn::before { opacity: 1; }
.sky.day { --a: #1d8fd0; --b: #6fc7ee; }
.sky.dusk { --a: #2a2a63; --b: #e8613a; }
.sky.night { --a: #10143a; --b: #232a63; }
.sky.night::after { /* ดาวและเสี้ยวจันทร์ */
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 82% 22%, transparent 0 15px, var(--sun) 16px 24px, transparent 25px),
    radial-gradient(circle 1.5px at 12% 28%, #fff 98%, transparent), radial-gradient(circle 1.5px at 30% 12%, #fff 98%, transparent),
    radial-gradient(circle 1px at 58% 24%, #fff 98%, transparent), radial-gradient(circle 1.5px at 70% 62%, #fff 98%, transparent),
    radial-gradient(circle 1px at 90% 70%, #fff 98%, transparent), radial-gradient(circle 1px at 20% 74%, #fff 98%, transparent);
}
.sky .hello { font-size: 15px; opacity: .92; }
.sky .time { font-size: 56px; font-weight: 700; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sky .date { font-size: 14px; opacity: .88; }
.sky .where { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 13px; backdrop-filter: blur(4px); }

/* ---------- ปุ่มลงเวลา ---------- */
.clock-zone { display: grid; place-items: center; padding: 10px 0 6px; gap: 12px; }
.clock-btn {
  width: 184px; height: 184px; border-radius: 50%; border: 0; display: grid; place-items: center; align-content: center; gap: 2px;
  font-weight: 700; font-size: 26px; transition: transform .12s;
}
.clock-btn small { font-weight: 500; font-size: 13px; opacity: .85; }
.clock-btn:active { transform: scale(.96); }
.clock-btn.in { background: var(--sun); color: var(--night); box-shadow: 0 0 0 8px rgba(245, 225, 26, .28), 0 0 0 16px rgba(245, 225, 26, .12); }
.clock-btn.out { background: var(--shrimp); color: #fff; box-shadow: 0 0 0 8px rgba(232, 49, 47, .22), 0 0 0 16px rgba(232, 49, 47, .1); }
.clock-btn:disabled { background: var(--line); color: var(--ink-3); box-shadow: none; }
.clock-note { text-align: center; color: var(--ink-2); font-size: 14px; max-width: 300px; }

/* ---------- องค์ประกอบทั่วไป ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; margin-bottom: 12px; }
.card.flat { border: 0; background: transparent; padding: 0; }
.h-sec { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 20px 4px 8px; }
.h-sec:first-child { margin-top: 4px; }
.title { font-size: 24px; font-weight: 700; margin: 4px 4px 12px; }
.muted { color: var(--ink-3); font-size: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { font-size: 13px; color: var(--ink-3); }
.tap { width: 100%; text-align: left; background: none; border: 0; }
.right { margin-left: auto; text-align: right; }

.btn { min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--night); background: var(--night); color: #fff; font-weight: 600; }
.btn.alt { background: var(--card); color: var(--night); }
.btn.red { background: var(--shrimp); border-color: var(--shrimp); }
.btn.sun { background: var(--sun); border-color: var(--sun); color: var(--night); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(29, 161, 220, .2); }
.field .hint { font-size: 12px; color: var(--ink-3); margin: 4px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 14px; }
.switch input { width: 22px; height: 22px; accent-color: var(--mark); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--c, var(--line)); color: #fff; white-space: nowrap; }
.chip.dk { color: var(--night); }
.chip.light { background: var(--chipbg); color: var(--ink-2); }
.chip.warn { background: #fff1de; color: var(--warn); }
.chip.bad { background: #ffe4e3; color: #c11f1d; }
.chip.good { background: #dff5ea; color: var(--ok); }
.chip.sunny { background: var(--sun); color: var(--night); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; background: var(--night); color: var(--sun); overflow: hidden; object-fit: cover; }
.avatar.photo { background: var(--line); border: 0; padding: 0; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; text-align: center; }
.stat b { display: block; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-3); }
.stat.hot b { color: var(--shrimp); }

.empty { text-align: center; color: var(--ink-3); padding: 22px 12px; font-size: 14px; }
.seg { display: flex; background: var(--seg); padding: 3px; border-radius: 12px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: none; border-radius: 10px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--night); box-shadow: 0 1px 3px rgba(22, 26, 61, .15); }
.navrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.navrow .btn { min-height: 40px; padding: 0 14px; }
.navrow b { font-size: 16px; }

/* ---------- แท็บล่าง ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabs-in { max-width: 520px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: var(--tab-h); overflow: hidden; }
.tab { min-width: 0; padding: 0 2px; white-space: nowrap; overflow: visible; -webkit-tap-highlight-color: transparent; transition: color .18s, transform .12s; border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 1px; color: var(--ink-3); font-size: 11.5px; font-weight: 500; position: relative; }
.tab:active { transform: scale(.94); }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--mark); font-weight: 700; }
.tab.on::before { content: ''; position: absolute; top: 0; width: 28px; height: 4px; border-radius: 0 0 4px 4px; background: var(--sun); }
.tab .badge { position: absolute; top: 4px; left: calc(50% + 4px); pointer-events: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--shrimp); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- แผ่นล่าง / ป๊อปอัป ---------- */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(12, 14, 40, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease-out; }
.sheet { width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; background: var(--paper); border-radius: 24px 24px 0 0; padding: 8px 16px calc(20px + var(--safe-b)); animation: up .22s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { font-size: 20px; margin: 0 2px 12px; }
.full { position: fixed; inset: 0; z-index: 50; background: var(--night); color: #fff; display: flex; flex-direction: column; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 90; background: var(--night); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14px; max-width: 88vw; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast.err { background: #b3201f; }

/* ---------- เข้าสู่ระบบ ---------- */
.login-top { background: var(--night); color: #fff; margin: calc(-16px - var(--safe-t)) -16px 18px; padding: calc(30px + var(--safe-t)) 20px 26px; border-radius: 0 0 28px 28px; position: relative; overflow: hidden; text-align: center; }
.login-top::before { content: ''; position: absolute; left: 50%; bottom: -170px; width: 460px; height: 460px; margin-left: -230px; background: repeating-conic-gradient(from -90deg at 50% 50%, rgba(245, 225, 26, .38) 0 6deg, transparent 6deg 12deg); -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 70%); mask-image: radial-gradient(circle, #000 25%, transparent 70%); }
.login-top img { width: 84px; height: 84px; border-radius: 50%; position: relative; border: 3px solid #fff; }
.login-top h1 { position: relative; font-size: 28px; margin-top: 8px; }
.login-top p { position: relative; font-size: 14px; opacity: .85; }
.people { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.person { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; display: grid; justify-items: center; gap: 6px; font-weight: 600; text-align: center; overflow-wrap: anywhere; }
.person small { font-weight: 400; color: var(--ink-3); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 14px 0 18px; min-height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pin-dots i.f { background: var(--mark); border-color: var(--mark); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
.pad button { height: 62px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-size: 24px; font-weight: 600; }
.pad button:active { background: var(--sun); }
.pad button.ghost { background: none; border: 0; font-size: 15px; color: var(--ink-2); }
.err-text { color: #b3201f; text-align: center; font-size: 14px; min-height: 22px; margin-bottom: 4px; }

/* ---------- ลงเวลา (เต็มจอ) ---------- */
.cam-top { padding: calc(14px + var(--safe-t)) 16px 8px; display: flex; justify-content: space-between; align-items: center; }
.cam-top .x { background: rgba(255, 255, 255, .15); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; }
.cam-body { flex: 1; display: grid; place-items: center; align-content: center; gap: 16px; padding: 8px 20px; text-align: center; }
.cam-ring { width: min(72vw, 300px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 5px solid var(--sun); background: #0b0e2a; display: grid; place-items: center; }
.cam-ring video, .cam-ring img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-ring img { transform: none; }
.gps { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: 14px; }
.gps.ok { background: rgba(23, 147, 91, .4); }
.gps.bad { background: rgba(232, 49, 47, .45); }
.cam-foot { padding: 12px 20px calc(22px + var(--safe-b)); display: grid; gap: 10px; }
.shutter { justify-self: center; width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: var(--sun); }
.shutter:disabled { opacity: .35; }
.done-ico { width: 96px; height: 96px; border-radius: 50%; background: var(--sun); color: var(--night); display: grid; place-items: center; font-size: 48px; }

/* ---------- ตารางเวร ---------- */
.grid-wrap { overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; }
.grid th, .grid td { padding: 4px 2px; text-align: center; font-weight: 500; }
.grid th { font-size: 12px; color: var(--ink-3); padding-bottom: 8px; }
.grid th.today { color: var(--shrimp); font-weight: 700; }
.grid th b { display: block; font-size: 15px; color: var(--ink); }
.grid th.today b { color: var(--shrimp); }
.grid td.who { text-align: left; position: sticky; left: 0; background: var(--paper); font-size: 13px; font-weight: 600; padding-right: 4px; width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; z-index: 1; }
.cell { width: 100%; min-width: 0; height: 40px; border-radius: 10px; border: 1.5px dashed var(--line); background: none; font-size: 12px; font-weight: 700; color: #fff; padding: 0; }
.cell.set { border: 0; background: var(--c); }
.cell.set.dark { color: var(--mark); }
.cell.req { box-shadow: 0 0 0 2px var(--sun) inset; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); }
.legend .lg-i { flex: 1 1 64px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.legend .lg-n { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.legend small { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.day-card:last-child { border-bottom: 0; }
.day-card .d { width: 52px; flex: none; text-align: center; }
.day-card .d b { display: block; font-size: 22px; line-height: 1.1; }
.day-card .d span { font-size: 12px; color: var(--ink-3); }
.day-card.today .d b { color: var(--shrimp); }
.team { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.team b { color: var(--ink-2); font-weight: 600; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); margin-bottom: 8px; font-weight: 600; text-align: left; }
.opt.on { border-color: var(--mark); }
.opt small { display: block; font-weight: 400; color: var(--ink-3); }

/* ---------- รายงาน ---------- */
.sumrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; text-align: center; }
.sumrow div { background: var(--paper); border-radius: 10px; padding: 6px 2px; }
.sumrow b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.sumrow span { font-size: 11px; color: var(--ink-3); }
.sumrow .bad b { color: var(--shrimp); }
.thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--line); border: 0; padding: 0; }
.photo-pair { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.photo-pair figure { margin: 0; text-align: center; font-size: 13px; color: var(--ink-3); }
.photo-pair img, .photo-pair .ph { width: 140px; height: 140px; border-radius: 16px; object-fit: cover; display: grid; place-items: center; background: var(--line); }
.note { background: var(--note); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.steps { padding-left: 20px; margin: 8px 0; font-size: 14px; color: var(--ink-2); }
.steps li { margin-bottom: 6px; }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }
.code-big { font-size: 22px; font-weight: 700; letter-spacing: .12em; background: var(--note); padding: 8px 14px; border-radius: 12px; display: inline-block; }
a { color: var(--sky); }

.langbar{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:4px 0 12px}
.langbar .lg{border:1.5px solid var(--line,#d9dce8);background:var(--card);border-radius:999px;padding:8px 16px;font-weight:600;min-height:40px}
.langbar .lg.on{background:var(--night,#161a3d);color:#fff;border-color:var(--night,#161a3d)}

/* =====================================================================
   MOTION LAYER — เคลื่อนไหวให้รู้สึกมีชีวิต (ปิดอัตโนมัติเมื่อเครื่องตั้ง reduce motion)
   ===================================================================== */
:root { --spring: cubic-bezier(.2, .9, .3, 1.25); --ease-out: cubic-bezier(.16, 1, .3, 1); }

/* เปลี่ยนหน้า: สไลด์ตามทิศแท็บ + รายการไหลขึ้นทีละชิ้น */
.screen.enter { animation: scrIn .34s var(--ease-out) both; }
.screen.enter.dir-r { --dx: 22px; }
.screen.enter.dir-l { --dx: -22px; }
@keyframes scrIn { from { opacity: 0; transform: translateX(var(--dx, 0)) translateY(8px); } }
.screen.enter > * { animation: rise .5s var(--ease-out) both; }
.screen.enter > *:nth-child(1) { animation-delay: .02s; }
.screen.enter > *:nth-child(2) { animation-delay: .07s; }
.screen.enter > *:nth-child(3) { animation-delay: .12s; }
.screen.enter > *:nth-child(4) { animation-delay: .17s; }
.screen.enter > *:nth-child(5) { animation-delay: .22s; }
.screen.enter > *:nth-child(6) { animation-delay: .27s; }
.screen.enter > *:nth-child(n+7) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.screen.enter .sky { animation: none; }
.screen.enter .people .person { animation: pop .45s var(--spring) both; }
.screen.enter .people .person:nth-child(2) { animation-delay: .05s; } .screen.enter .people .person:nth-child(3) { animation-delay: .1s; }
.screen.enter .people .person:nth-child(4) { animation-delay: .15s; } .screen.enter .people .person:nth-child(n+5) { animation-delay: .2s; }
@keyframes pop { from { opacity: 0; transform: scale(.86); } }

/* skeleton ระหว่างโหลด */
.skel { display: grid; gap: 12px; }
.skel i { display: block; border-radius: 18px; background: linear-gradient(100deg, #e5eaf4 30%, #f4f7fc 50%, #e5eaf4 70%); background-size: 220% 100%; animation: shimmer 1.2s linear infinite; }
.skel .h1 { height: 150px; border-radius: 0 0 28px 28px; margin: calc(-16px - var(--safe-t)) -16px 6px; }
.skel .h2 { height: 164px; width: 164px; border-radius: 50%; margin: 6px auto; }
.skel .h3 { height: 70px; } .skel .h4 { height: 110px; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* ท้องฟ้า: รัศมีหมุนช้า เมฆลอย ดาวระยิบ พระจันทร์เรือง */
.sky::before { animation: rays 60s linear infinite; }
@keyframes rays { to { transform: rotate(360deg); } }
.sky.day::after, .sky.dusk::after, .sky.dawn::after {
  content: ''; position: absolute; left: -40%; top: 18px; width: 70px; height: 22px; border-radius: 22px; z-index: -1;
  background: rgba(255, 255, 255, .55); box-shadow: 26px -9px 0 6px rgba(255, 255, 255, .55), 52px 2px 0 -2px rgba(255, 255, 255, .5);
  animation: cloud 38s linear infinite;
}
.sky.dusk::after { background: rgba(255, 214, 190, .5); box-shadow: 26px -9px 0 6px rgba(255, 214, 190, .5), 52px 2px 0 -2px rgba(255, 214, 190, .45); animation-duration: 52s; }
@keyframes cloud { to { transform: translateX(260%); } }
.sky.night::after { animation: twinkle 3.4s ease-in-out infinite alternate; }
@keyframes twinkle { 0% { opacity: .75; } 50% { opacity: 1; } 100% { opacity: .82; } }
.sky .time { animation: timeIn .7s var(--ease-out) both; }
@keyframes timeIn { from { opacity: 0; letter-spacing: .08em; transform: translateY(6px); } }

/* ปุ่มลงเวลา: หายใจเป็นวง + กดแล้วยุบ-เด้ง */
.clock-btn { position: relative; transition: transform .2s var(--spring); animation: btnIn .6s var(--spring) both; touch-action: manipulation; }
.clock-btn:active:not(:disabled) { transform: scale(.93); }
@keyframes btnIn { from { transform: scale(.7); opacity: 0; } }
.clock-btn::before, .clock-btn::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; pointer-events: none; }
.clock-btn.in { color: var(--night); } .clock-btn.out { color: #fff; }
.clock-btn.in::before, .clock-btn.out::before { border-color: var(--sun); animation: ping 2.4s var(--ease-out) infinite; }
.clock-btn.out::before { border-color: var(--shrimp); }
.clock-btn.in::after { border-color: var(--sun); animation: ping 2.4s var(--ease-out) 1.2s infinite; }
.clock-btn.out::after { border-color: var(--shrimp); animation: ping 2.4s var(--ease-out) 1.2s infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
.clock-btn.in, .clock-btn.out { animation: btnIn .6s var(--spring) both, breathe 3.2s ease-in-out .6s infinite; }
@keyframes breathe { 50% { transform: scale(1.025); } }
.clock-btn:disabled::before, .clock-btn:disabled::after { display: none; }
.clock-btn:disabled { animation: btnIn .6s var(--spring) both; }
.clock-btn.out small, .clock-btn.in small { position: relative; }

/* แท็บล่าง: ตัวชี้เลื่อนเด้ง ไอคอนยกขึ้น */
.tab { transition: color .2s, transform .15s; }
.tab:active { transform: scale(.9); }
.tab svg { transition: transform .35s var(--spring); }
.tab.on svg { transform: translateY(-2px) scale(1.12); }
.tab.on::before { animation: tabBar .4s var(--spring) both; }
@keyframes tabBar { from { width: 0; opacity: 0; } }
.tab .badge { animation: badge 2s ease-in-out infinite; }
@keyframes badge { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.22); } 90% { transform: scale(.95); } }

/* ปุ่ม/การ์ดทั่วไป: ตอบสนองการสัมผัส */
.btn { transition: transform .18s var(--spring), box-shadow .2s, opacity .2s; }
.btn:active:not(:disabled) { transform: scale(.96); }
.row.tap, .person, .opt { transition: background-color .15s, transform .18s var(--spring), border-color .2s; }
.row.tap:active { background: rgba(22, 26, 61, .04); }
.person:active { transform: scale(.95); }
.person:hover { border-color: var(--sky); }
.opt:active { transform: scale(.98); }
.seg button { transition: background-color .2s, color .2s, box-shadow .2s; }
.cell { transition: transform .18s var(--spring), background-color .2s; }
.cell:active { transform: scale(.86); }
.cell.set { animation: pop .35s var(--spring) both; }

/* แผ่นล่างและป๊อปอัป: เด้งขึ้นแบบสปริง */
.backdrop { animation: fade .25s ease-out; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { animation: sheetUp .42s var(--spring); }
@keyframes sheetUp { from { transform: translateY(70%); opacity: .4; } }
.sheet .grab { animation: grab .6s .2s var(--ease-out) both; }
@keyframes grab { from { width: 16px; opacity: 0; } }
.toast { animation: toastIn .45s var(--spring) both; }
@keyframes toastIn { from { transform: translate(-50%, 24px) scale(.9); opacity: 0; } }
.toast.err { animation: toastIn .45s var(--spring) both, nudge .4s .2s; }
@keyframes nudge { 20%, 60% { margin-left: -6px; } 40%, 80% { margin-left: 6px; } }

/* PIN: จุดเด้งตอนกด สั่นเมื่อผิด */
.pin-dots i { transition: background-color .15s, border-color .15s; }
.pin-dots i.f { animation: dotPop .3s var(--spring); }
@keyframes dotPop { 0% { transform: scale(.5); } 100% { transform: scale(1); } }
.pin-dots.shake { animation: shake .45s; }
@keyframes shake { 15%, 45%, 75% { transform: translateX(-9px); } 30%, 60%, 90% { transform: translateX(9px); } }
.pad button { transition: transform .15s var(--spring), background-color .15s; }
.pad button:active { transform: scale(.9); }

/* หน้าลงเวลาเต็มจอ: วงสแกน + แฟลชชัตเตอร์ */
.cam-ring { position: relative; transition: border-color .3s, box-shadow .4s; animation: ringIn .55s var(--spring) both; }
@keyframes ringIn { from { transform: scale(.8); opacity: 0; } }
.full.ready .cam-ring { border-color: #3ddc97; box-shadow: 0 0 0 10px rgba(61, 220, 151, .16), 0 0 40px rgba(61, 220, 151, .35); }
.cam-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; pointer-events: none; border: 5px solid transparent; border-top-color: rgba(255, 255, 255, .9); border-right-color: rgba(255, 255, 255, .25); animation: scan 1.1s linear infinite; }
.full.ready .cam-ring::after { display: none; }
@keyframes scan { to { transform: rotate(360deg); } }
.gps { transition: background-color .3s; animation: rise .4s var(--ease-out) both; }
.shutter { position: relative; transition: transform .15s var(--spring), opacity .2s; }
.shutter::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid var(--sun); opacity: 0; }
.shutter:not(:disabled)::after { animation: ping 1.8s var(--ease-out) infinite; }
.shutter:active:not(:disabled) { transform: scale(.88); }
.flash { position: fixed; inset: 0; z-index: 70; background: #fff; pointer-events: none; animation: flash .45s ease-out forwards; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

/* สำเร็จ: วงเช็กถูกวาดเส้น + confetti */
.full.done { background: radial-gradient(circle at 50% 38%, #26307a 0, var(--night) 62%); }
.done-ico { position: relative; background: none; width: 120px; height: 120px; animation: pop .55s var(--spring) both; }
.done-ico svg { width: 120px; height: 120px; overflow: visible; }
.done-ico .disc { fill: var(--sun); transform-origin: 50% 50%; animation: pop .5s var(--spring) both; }
.done-ico .tick { fill: none; stroke: var(--night); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .5s .28s var(--ease-out) forwards; }
.done-ico .halo { fill: none; stroke: var(--sun); stroke-width: 3; transform-origin: 50% 50%; animation: halo 1.1s .25s var(--ease-out) both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes halo { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.full.done h1 { animation: rise .6s .35s var(--ease-out) both; }
.full.done .cam-foot { animation: rise .6s .5s var(--ease-out) both; }
.confetti { position: fixed; left: 50%; top: 38%; width: 0; height: 0; z-index: 80; pointer-events: none; }
.confetti i { position: absolute; width: 9px; height: 14px; border-radius: 2px; background: var(--c); animation: burst 1.5s var(--ease-out) forwards; opacity: 0; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(1); }
}

/* ตัวเลขสถิติ: เด้งตอนนับถึงค่า */
.stat b.cnt { animation: statPop .35s var(--spring); }
@keyframes statPop { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
.stat { transition: transform .18s var(--spring); }
.stat:active { transform: scale(.95); }

@media (prefers-reduced-motion: reduce) { .confetti, .flash, .cam-ring::after { display: none !important; } }

/* =====================================================================
   RESPONSIVE — มือถือเป็นหลัก ขยายให้ iPad/แท็บเล็ตและ PC/Mac ดูได้สบาย
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; }
body { -webkit-font-smoothing: antialiased; }
input, select, textarea { font-size: 16px; } /* กัน iOS ซูมเองตอนแตะช่องกรอก */
.tabs-in { max-width: none; }

/* จอแนวนอนเตี้ยๆ (มือถือหมุนจอ) — ลดความสูงปุ่ม/ท้องฟ้า */
@media (max-height: 480px) and (orientation: landscape) {
  .sky .time { font-size: 40px; }
  .clock-btn { width: 140px; height: 140px; font-size: 22px; }
  .cam-ring { width: min(48vh, 220px); }
  .cam-body { gap: 8px; }
}

/* iPad / แท็บเล็ต */
@media (min-width: 700px) {
  #app { max-width: 720px; }
  .screen { padding-left: 24px; padding-right: 24px; }
  .sky { margin-left: -24px; margin-right: -24px; padding-left: 28px; padding-right: 28px; border-radius: 0 0 32px 32px; }
  .skel .h1 { margin-left: -24px; margin-right: -24px; }
  .login-top { margin-left: -24px; margin-right: -24px; }
  .people { grid-template-columns: repeat(3, 1fr); }
  .tabs-in { max-width: 720px; }
  .stat b { font-size: 28px; }
  .sky .time { font-size: 68px; }
  .clock-btn { width: 210px; height: 210px; font-size: 30px; }
  .grid-wrap { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; border-radius: 24px; padding-top: 14px; animation: sheetPop .38s var(--spring); }
  .sheet .grab { display: none; }
  .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 18px); }
  .cam-body, .cam-foot, .cam-top { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }
  .cam-ring { width: min(52vh, 340px); }
}
@keyframes sheetPop { from { transform: translateY(24px) scale(.96); opacity: 0; } }

/* PC / Mac / iPad แนวนอน — เมนูแถบซ้าย เนื้อหากว้างขึ้น */
@media (min-width: 1000px) {
  body { background: linear-gradient(180deg, #e9eef8, #f3f6fb 40%); }
  #app { max-width: 1040px; padding-left: 224px; }
  .screen { padding-bottom: 40px; padding-top: 28px; }
  .screen.no-tabs { padding-left: 24px; }
  #app:has(.screen.no-tabs) { padding-left: 0; max-width: 640px; }
  .tabs {
    left: max(0px, calc(50% - 520px)); right: auto; top: 0; bottom: 0; width: 208px; height: auto;
    border-top: 0; border-right: 1px solid var(--line); background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px);
    padding: 24px 12px;
  }
  .tabs-in { display: flex; flex-direction: column; gap: 4px; height: auto; max-width: none; }
  .tab { display: flex; flex-direction: row; justify-content: flex-start; gap: 12px; height: 48px; padding: 0 14px; border-radius: 14px; font-size: 15px; }
  .tab:hover { background: rgba(22, 26, 61, .05); }
  .tab.on { background: var(--night); color: #fff; }
  .tab.on::before { display: none; }
  .tab.on svg { transform: none; }
  .tab .badge { position: static; margin-left: auto; }
  .sky { margin: -28px -24px 22px; border-radius: 0 0 32px 32px; }
  .skel .h1 { margin-top: -28px; }
  .toast { bottom: 28px; left: calc(50% + 100px); }
  .stats { gap: 12px; }
}

/* เมาส์/แทร็กแพด: ไฮไลต์ตอนชี้ */
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(22, 26, 61, .18); transform: translateY(-1px); }
  .row.tap:hover { background: rgba(22, 26, 61, .035); }
  .clock-btn:hover:not(:disabled) { transform: scale(1.03); }
  .cell:hover { transform: scale(1.08); }
  .langbar .lg:hover:not(.on) { border-color: var(--sky); }
  ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #c9d1e3; border-radius: 6px; }
}

/* มือถือหมุนจอแนวนอน (ต้องอยู่ท้ายสุดเพื่อชนะกฎแท็บเล็ต) */
@media (max-height: 480px) and (orientation: landscape) {
  .sky .time { font-size: 40px; }
  .sky { padding-top: calc(14px + var(--safe-t)); padding-bottom: 14px; }
  .clock-btn { width: 130px; height: 130px; font-size: 21px; }
  .clock-zone { padding: 4px 0; }
  .cam-ring { width: min(46vh, 200px); }
  .cam-body { gap: 8px; }
  .tabs-in { height: 52px; } :root { --tab-h: 52px; }
  .stat b { font-size: 22px; }
}

/* PIN: ช่องพิมพ์ซ้อนทับวงกลม ให้ใช้แป้นพิมพ์มือถือได้ */
.pin-wrap { position: relative; max-width: 320px; margin: 0 auto; }
.pin-in { position: absolute; inset: -8px 0; width: 100%; height: calc(100% + 16px); opacity: 0; font-size: 16px; border: 0; background: transparent; color: transparent; caret-color: transparent; cursor: text; }

/* ช่องเวลา/วันที่บน iOS มีความกว้างขั้นต่ำของตัวเอง ทำให้ล้นจอและทับกัน: บังคับให้อยู่ในคอลัมน์ */
.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.two > * { min-width: 0; }
.field input[type="time"], .field input[type="date"], .field input[type="month"] {
  display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
  -webkit-appearance: none; appearance: none; text-align: left; min-height: 48px;
}
.field input[type="time"]::-webkit-date-and-time-value, .field input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }

/* ปุ่มกากบาทปิดหน้าต่าง (ติดมุมขวาบน เลื่อนตามเมื่อเนื้อหายาว) */
.sheet-x { position: sticky; top: 0; float: right; z-index: 5; width: 44px; height: 44px; margin: -2px -6px -40px 0; border: 0; border-radius: 50%;
  background: var(--paper); color: var(--ink-2); font-size: 20px; line-height: 1; display: grid; place-items: center; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.sheet-x:active { transform: scale(.92); }
.sheet h2 { padding-right: 44px; }
/* กันหน้าจอซูมเข้า/ออกเอง และกันเลื่อนซ้าย-ขวา */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body { overflow-x: clip; }

/* โหมดมืด/สว่าง: ตามระบบเครื่องอัตโนมัติ หรือเลือกเองที่หน้าตั้งค่า */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e8ebf7; --ink-2: #b3b9d6; --ink-3: #8189ad;
    --paper: #0d1028; --card: #181c3d; --line: #2c3263;
    --seg: #23284f; --chipbg: #23284f; --soft: #23284f; --note: #3a3510;
    --ok: #3ddc97; --warn: #ffae45; --mark: #9aa8ff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8ebf7; --ink-2: #b3b9d6; --ink-3: #8189ad;
  --paper: #0d1028; --card: #181c3d; --line: #2c3263;
  --seg: #23284f; --chipbg: #23284f; --soft: #23284f; --note: #3a3510;
  --ok: #3ddc97; --warn: #ffae45; --mark: #9aa8ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { background: #343b8a; border-color: #4a54b8; }
  :root:not([data-theme="light"]) .btn.alt { background: var(--card); color: var(--ink); border-color: var(--line); }
  :root:not([data-theme="light"]) .seg button.on { color: #fff; background: #3a418f; }
  :root:not([data-theme="light"]) .chip.warn { background: #3d2a0c; }
  :root:not([data-theme="light"]) .chip.bad { background: #451a1c; color: #ff8d8b; }
  :root:not([data-theme="light"]) .chip.good { background: #12392b; }
  :root:not([data-theme="light"]) .langbar .lg.on { background: #343b8a; border-color: #4a54b8; }
  :root:not([data-theme="light"]) .skel i { background: linear-gradient(100deg, #1d2247 30%, #272d5c 50%, #1d2247 70%); background-size: 220% 100%; }
  :root:not([data-theme="light"]) body { background: var(--paper); }
  :root:not([data-theme="light"]) .row.tap:active { background: rgba(255,255,255,.06); }
  :root:not([data-theme="light"]) .err-text { color: #ff8d8b; }
}
:root[data-theme="dark"] .btn { background: #343b8a; border-color: #4a54b8; }
:root[data-theme="dark"] .btn.alt { background: var(--card); color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .seg button.on { color: #fff; background: #3a418f; }
:root[data-theme="dark"] .chip.warn { background: #3d2a0c; }
:root[data-theme="dark"] .chip.bad { background: #451a1c; color: #ff8d8b; }
:root[data-theme="dark"] .chip.good { background: #12392b; }
:root[data-theme="dark"] .langbar .lg.on { background: #343b8a; border-color: #4a54b8; }
:root[data-theme="dark"] .skel i { background: linear-gradient(100deg, #1d2247 30%, #272d5c 50%, #1d2247 70%); background-size: 220% 100%; }
:root[data-theme="dark"] body { background: var(--paper); }
:root[data-theme="dark"] .row.tap:active { background: rgba(255,255,255,.06); }
:root[data-theme="dark"] .err-text { color: #ff8d8b; }
.themebar { margin-top: 8px; }
@media (min-width: 1000px) {
  :root[data-theme="dark"] body { background: linear-gradient(180deg, #080a1f, #0d1028 40%); }
  :root[data-theme="dark"] .tabs { background: rgba(24,28,61,.9); }
}
@media (min-width: 1000px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body { background: linear-gradient(180deg, #080a1f, #0d1028 40%); }
  :root:not([data-theme="light"]) .tabs { background: rgba(24,28,61,.9); }
}

/* ประกาศความเป็นส่วนตัว */
.pd-list { padding: 4px 14px; }
.pd { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pd:last-child { border-bottom: 0; }
.pd b { font-weight: 700; }
.pd span { color: var(--ink-2); font-size: 15px; line-height: 1.55; }

.upd-bar { position: fixed; left: 12px; right: 12px; top: calc(var(--safe-t, 0px) + 10px); z-index: 95; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--night); color: #fff; border: 0; border-radius: 14px; padding: 12px 16px; font: inherit; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.upd-bar b { background: #f5e11a; color: #161a3d; border-radius: 10px; padding: 6px 12px; font-weight: 600; }
.seg button { font-size: 14px; padding: 4px 2px; line-height: 1.2; }

/* ตารางบัตรตอก: จัดกึ่งกลางทุกคอลัมน์ หัวตารางเข้ม แถวสลับสี แถวรวมสีเหลือง */
.tc-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tc-sum > div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 6px; text-align: center; }
.tc-sum b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.tc-sum span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.tc-wrap { border-radius: 18px; overflow: hidden; background: var(--card); margin-bottom: 14px; box-shadow: 0 6px 22px rgba(22, 26, 61, .09), 0 0 0 1px var(--line); }
table.tc { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.tc th, table.tc td { padding: 14px 8px; text-align: center; vertical-align: middle; border-bottom: 1px solid var(--line); font-size: 15px; }
table.tc thead th { background: var(--night); color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; border-bottom: 0; padding: 13px 8px; }
table.tc tbody tr:nth-child(even) { background: var(--paper); }
table.tc tbody tr { cursor: pointer; transition: background-color .15s; }
table.tc tbody tr:hover, table.tc tbody tr:focus-visible { background: var(--soft); outline: 0; }
table.tc td.tc-name b { display: block; font-size: 16px; }
table.tc td.tc-name small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
table.tc td.tc-b { font-weight: 700; white-space: nowrap; font-size: 16px; }
.tc-ot { display: inline-block; min-width: 46px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); font-weight: 700; font-size: 14px; }
.tc-dash { color: var(--ink-3); }
table.tc tfoot td { background: var(--sun); color: #161a3d; font-weight: 700; border-bottom: 0; font-size: 16px; padding: 15px 8px; }
@media (max-width: 420px) { table.tc th, table.tc td { padding: 11px 4px; font-size: 14px; } table.tc thead th { font-size: 12px; padding: 11px 4px; } .tc-ot { padding: 2px 7px; min-width: 0; } }

/* ---------- ขัดเกลา: ทุกอุปกรณ์ ---------- */
html { overflow-x: clip; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, .btn, .tab, .seg button { touch-action: manipulation; }
.btn { transition: transform .12s var(--ease-out), filter .15s, background-color .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.seg button { transition: background-color .18s, color .18s, box-shadow .18s; }
@media (hover: hover) { .btn:hover:not(:disabled) { filter: brightness(1.04); } }
@media (pointer: coarse) { .seg button, .navrow .btn { min-height: 44px; } }

/* ---------- ปุ่มภาษา/หน้าจอ มุมขวาบน ---------- */
#topbar { position: fixed; z-index: 30; top: calc(10px + var(--safe-t)); right: max(12px, env(safe-area-inset-right, 0px)); display: flex; gap: 8px; }
.tb-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--ink-2); display: grid; place-items: center; padding: 0; box-shadow: 0 1px 4px rgba(22, 26, 61, .12); transition: transform .12s var(--ease-out), background-color .18s; }
.tb-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-btn:active { transform: scale(.92); }
@media (pointer: coarse) { .tb-btn { width: 44px; height: 44px; } }
#lang-pop { position: fixed; z-index: 31; top: calc(58px + var(--safe-t)); right: max(12px, env(safe-area-inset-right, 0px)); min-width: 150px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 6px; box-shadow: 0 10px 30px rgba(22, 26, 61, .22); animation: popIn .16s var(--ease-out); transform-origin: top right; }
#lang-pop button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; border-radius: 11px; font-weight: 600; min-height: 44px; }
#lang-pop button.on { background: var(--night); color: #fff; }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(-4px); } }
.screen > .title:first-child, .screen > h1:first-child { padding-right: 150px; }
@media (min-width: 1000px) { .screen > .title:first-child { padding-right: 0; } }

.tb-lang { height: 40px; border-radius: 20px; border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--ink); display: flex; align-items: center; gap: 6px; padding: 0 10px 0 8px; font-weight: 700; font-size: 13.5px; box-shadow: 0 1px 4px rgba(22, 26, 61, .12); transition: transform .12s var(--ease-out); }
.tb-lang:active { transform: scale(.95); }
.flag { display: inline-block; width: 22px; height: 15px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); flex: none; line-height: 0; }
.flag svg { width: 100%; height: 100%; display: block; }
.tb-lang .chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#lang-pop button { display: flex; align-items: center; gap: 10px; }
@media (pointer: coarse) { .tb-lang { height: 44px; } }

/* ---------- แสดงสถานะกำลังโหลด ---------- */
#loadbar { position: fixed; z-index: 60; left: 0; right: 0; top: 0; height: 3px; overflow: hidden; pointer-events: none; transition: opacity .25s; }
#loadbar.done { opacity: 0; }
#loadbar i { position: absolute; inset: 0 auto 0 0; width: 40%; background: linear-gradient(90deg, var(--sun), var(--shrimp)); border-radius: 0 3px 3px 0; animation: lbar 1.1s var(--ease-out) infinite; }
@keyframes lbar { from { left: -40%; } to { left: 100%; } }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2.5px solid rgba(128, 128, 150, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.alt.is-busy::after, .btn.sun.is-busy::after { border-top-color: var(--night); }
.clock-btn.is-busy { animation: busyPulse .9s ease-in-out infinite; }
@keyframes busyPulse { 50% { opacity: .55; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- หน้ากำลังโหลดตอนเปิดแอป ---------- */
.splash { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink-2); }
.splash img { width: 96px; height: 96px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 20px rgba(22, 26, 61, .18); animation: splashBob 1.2s ease-in-out infinite; }
.splash p { font-weight: 600; font-size: 16px; }
.splash .dots { display: flex; gap: 7px; }
.splash .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--shrimp); animation: dotJump 1s ease-in-out infinite; }
.splash .dots i:nth-child(2) { background: var(--sun); animation-delay: .15s; }
.splash .dots i:nth-child(3) { background: var(--sky); animation-delay: .3s; }
@keyframes splashBob { 50% { transform: translateY(-8px) rotate(-3deg); } }
@keyframes dotJump { 0%, 70%, 100% { transform: translateY(0); opacity: .5; } 35% { transform: translateY(-9px); opacity: 1; } }

/* ---------- หน้า PIN: รูปโปรไฟล์ + เอฟเฟกต์ ---------- */
.pin-top { padding-top: calc(62px + var(--safe-t)); }
.pin-hi { margin-top: -6px; }
.pin-top::before { animation: raySpin 60s linear infinite; }
@keyframes raySpin { to { transform: rotate(360deg); } }
.pin-hi { position: relative; font-size: 15px; font-weight: 500; opacity: 0; animation: pinUp .5s .05s var(--ease-out) forwards; }
.pin-av { position: relative; width: 116px; height: 116px; margin: 10px auto 12px; display: grid; place-items: center; animation: avPop .7s .1s var(--spring) both; }
.pin-av .avatar { width: 100px; height: 100px; font-size: 42px; border: 3px solid #fff; position: relative; z-index: 2; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.pin-av .avatar.photo { background: #fff; }
.pin-av .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, var(--sun), var(--shrimp), var(--sky), var(--sun)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); animation: spin 3.2s linear infinite; z-index: 1; }
.pin-av .glow { position: absolute; inset: -14px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 225, 26, .45), transparent 68%); animation: glowPulse 2.4s ease-in-out infinite; }
.pin-top h1 { position: relative; opacity: 0; animation: pinUp .5s .25s var(--ease-out) forwards; }
.pin-full, .pin-role, .pin-top p { position: relative; opacity: 0; animation: pinUp .5s .35s var(--ease-out) forwards; }
.pin-full { font-size: 14px; opacity: .8; margin-top: 2px; }
.pin-role { display: inline-block; margin: 8px 0 6px; padding: 2px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); font-size: 12.5px; font-weight: 600; animation-delay: .42s; }
.pin-top p { animation-delay: .5s; }
@keyframes pinUp { from { opacity: 0; transform: translateY(10px); } to { opacity: var(--o, 1); transform: none; } }
.pin-full { --o: .8; }
@keyframes avPop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }
@keyframes glowPulse { 50% { transform: scale(1.12); opacity: .65; } }

/* ---------- หน้า PIN: กระชับให้พอดีจอ ---------- */
.pin-top { padding: calc(54px + var(--safe-t)) 20px 18px; }
.pin-hi { margin-top: -8px; font-size: 14px; }
.pin-av { width: 92px; height: 92px; margin: 6px auto 8px; }
.pin-av .avatar { width: 80px; height: 80px; font-size: 34px; }
.pin-top h1 { font-size: 24px; line-height: 1.25; }
.pin-sub { position: relative; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13.5px; opacity: 0; animation: pinUp .5s .4s var(--ease-out) forwards; }
.pin-sub .pin-role { margin: 0; opacity: 1; animation: none; padding: 1px 10px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .16); border-radius: 999px; }
.pin-top .pin-full, .pin-top p { display: none; }
.pin-dots { margin: 12px 0 12px; }
.pad { gap: 8px; }
.pad button { height: clamp(50px, 7.4dvh, 62px); }
@media (max-height: 740px) { .pin-hi { display: none; } .pin-top { padding-top: calc(50px + var(--safe-t)); } .pin-av { width: 78px; height: 78px; } .pin-av .avatar { width: 68px; height: 68px; font-size: 29px; } }

/* ---------- รายชื่อตอนเลือกชื่อ: ไล่โผล่ทีละใบ ---------- */
.people .person { animation: personIn .5s var(--spring) both; }
.people .person:nth-child(1) { animation-delay: .05s; } .people .person:nth-child(2) { animation-delay: .1s; }
.people .person:nth-child(3) { animation-delay: .15s; } .people .person:nth-child(4) { animation-delay: .2s; }
.people .person:nth-child(5) { animation-delay: .25s; } .people .person:nth-child(6) { animation-delay: .3s; }
.people .person:nth-child(n+7) { animation-delay: .35s; }
@keyframes personIn { from { opacity: 0; transform: translateY(14px) scale(.9); } }
.splash img { animation: splashBob 1.2s ease-in-out infinite, splashGlow 2.4s ease-in-out infinite; }
@keyframes splashGlow { 50% { box-shadow: 0 6px 30px rgba(245, 225, 26, .7); } }

/* ---------- มูฟเมนต์ปุ่มภาษา/โหมดสี ---------- */
#topbar { animation: tbIn .55s .15s var(--spring) both; }
@keyframes tbIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
.tb-lang .chev { transition: transform .25s var(--ease-out); }
.tb-lang.open .chev { transform: rotate(180deg); }
.tb-lang.open { border-color: var(--sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 30%, transparent); }
.tb-btn svg { transition: transform .5s var(--spring); }
.tb-btn.swap svg { animation: iconSwap .6s var(--spring); }
@keyframes iconSwap { 0% { transform: rotate(-120deg) scale(.2); opacity: 0; } 70% { transform: rotate(12deg) scale(1.15); opacity: 1; } 100% { transform: none; } }
.tb-btn.swap { animation: tbPulse .6s ease-out; }
@keyframes tbPulse { 0% { box-shadow: 0 0 0 0 rgba(245, 225, 26, .7); } 100% { box-shadow: 0 0 0 14px rgba(245, 225, 26, 0); } }
@media (hover: hover) { .tb-btn:hover svg { transform: rotate(25deg); } .tb-lang:hover { transform: translateY(-1px); } }
#lang-pop button { animation: popItem .3s var(--ease-out) both; }
#lang-pop button:nth-child(2) { animation-delay: .04s; } #lang-pop button:nth-child(3) { animation-delay: .08s; } #lang-pop button:nth-child(4) { animation-delay: .12s; }
@keyframes popItem { from { opacity: 0; transform: translateX(8px); } }
#lang-pop .flag { transition: transform .2s var(--spring); }
@media (hover: hover) { #lang-pop button:hover:not(.on) { background: var(--seg); } #lang-pop button:hover .flag { transform: scale(1.15) rotate(-4deg); } }

/* ---------- หน้าเลือกชื่อ: คลื่นไล่เด้ง + เลือกแล้วขยายรูปเข้าไปหน้า PIN ---------- */
.people .person { animation: personWave .7s var(--spring) both !important; animation-delay: calc(var(--i, 0) * 70ms + 120ms) !important; }
@keyframes personWave { 0% { opacity: 0; transform: translateY(40px) scale(.7) rotate(calc((var(--i, 0) % 2 - .5) * 14deg)); } 60% { opacity: 1; transform: translateY(-6px) scale(1.04) rotate(0); } 100% { transform: none; } }
.person .avatar { transition: transform .3s var(--spring), box-shadow .3s; }
@media (hover: hover) { .person:hover .avatar { transform: scale(1.08); box-shadow: 0 0 0 3px var(--sun), 0 6px 16px rgba(22, 26, 61, .25); } }
.people.choosing .person:not(.picked) { opacity: .25; transform: scale(.92); filter: blur(1px); pointer-events: none; transition: all .28s var(--ease-out); animation: none !important; }
.people.choosing .person.picked { animation: none !important; transform: scale(1.06); border-color: var(--sun); box-shadow: 0 0 0 3px rgba(245, 225, 26, .55), 0 10px 26px rgba(22, 26, 61, .22); transition: all .28s var(--spring); z-index: 2; }
.people.choosing .person.picked .avatar { animation: pickRing .32s ease-out; box-shadow: 0 0 0 4px var(--sun); }
@keyframes pickRing { from { box-shadow: 0 0 0 0 rgba(245, 225, 26, .9); } to { box-shadow: 0 0 0 4px var(--sun); } }

/* ---------- ภาพรวม: การ์ดแตะได้ + แถบเตือนรอบจ่าย ---------- */
button.stat { font: inherit; color: inherit; cursor: pointer; }
.stat.tap:hover { border-color: var(--sky); }
.mini-stats { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin: -4px 0 12px; }
.mini-stats > * { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; display: flex; align-items: baseline; justify-content: center; gap: 8px; font: inherit; color: inherit; }
.mini-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 12px; color: var(--ink-3); }
.mini-stats .hot b { color: var(--shrimp); }
.mini-stats button { cursor: pointer; }
.paydue { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin: 0 0 12px; padding: 12px 14px; border: 1.5px solid var(--sun); border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--sun) 28%, var(--card)), var(--card)); cursor: pointer; font: inherit; color: inherit; animation: payPulse 2.4s ease-in-out infinite; }
.paydue .pd-ic { font-size: 26px; }
.paydue b { display: block; font-size: 15px; }
.paydue small { color: var(--ink-2); font-size: 13px; }
.paydue .pd-go { font-size: 22px; color: var(--ink-3); }
@keyframes payPulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--sun) 30%, transparent); } }

/* ---------- ช่องค้นหา ---------- */
.searchbox { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 0 12px; margin: 0 0 10px; min-height: 46px; transition: border-color .2s, box-shadow .2s; }
.searchbox:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky) 25%, transparent); }
.searchbox svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: 10px 0; }
/* ---------- หัวหน้าเลือกชื่อ ---------- */
.lg-now { position: relative; margin-top: 10px; display: flex; justify-content: center; align-items: baseline; gap: 10px; animation: pinUp .5s .3s var(--ease-out) both; }
.lg-now b { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.lg-now span { font-size: 14px; opacity: .85; }
.lg-greet { position: relative; font-size: 14px; opacity: .9; margin-top: 2px; animation: pinUp .5s .4s var(--ease-out) both; }

/* ---------- พิมพ์ / บันทึก PDF ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; }
  #topbar, #lang-pop, #loadbar, .tabs, nav, .no-print, .seg, .navrow .btn, .upd-bar, #layer, .btns, .toast { display: none !important; }
  #app { max-width: none !important; margin: 0 !important; }
  .screen { padding: 0 !important; animation: none !important; }
  .screen > * { animation: none !important; opacity: 1 !important; transform: none !important; }
  .print-only { display: block; font-size: 18px; margin: 4px 0 10px; }
  .title { padding: 0 !important; }
  .card, .tc-wrap { box-shadow: none !important; break-inside: avoid; }
  .tc-wrap { overflow: visible !important; }
  button.row { border: 0; }
  .tc-wrap { box-shadow: 0 0 0 1px #999 !important; border-radius: 0 !important; }
  table.tc thead th { background: #e9ecf3 !important; color: #111 !important; }
  table.tc tfoot td { background: #f1eb9a !important; }
  .tc-sum > div { border: 1px solid #999; }
  * { color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- แพ็กเกจและค่าบริการ ---------- */
.plan-card { background: linear-gradient(135deg, var(--card), color-mix(in srgb, var(--sun) 14%, var(--card))); }
.plan-card.is-full { border-color: var(--sun); }
.plan-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-price { font-size: 30px; font-variant-numeric: tabular-nums; }
.meter { height: 12px; border-radius: 6px; background: var(--seg); margin: 12px 0 8px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--sky), var(--sun)); transform-origin: left; animation: meterIn .9s var(--ease-out) both; }
.plan-card.is-full .meter i { background: linear-gradient(90deg, var(--sun), var(--shrimp)); }
@keyframes meterIn { from { transform: scaleX(0); } }
.plan-nums { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); }
.plan-nums b { color: var(--ink); font-size: 16px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.stepper .btn { width: 56px; padding: 0; font-size: 26px; }
.st-v { text-align: center; }
.st-v b { font-size: 28px; font-variant-numeric: tabular-nums; }
.st-v span { display: block; font-size: 13px; color: var(--ink-3); }
.plan-inv .row { gap: 10px; }
.plan-inv .right { text-align: right; }
.st-v span b { font-size: 15px; color: var(--ink); }

/* ---------- QR + เอกสารพิมพ์ ---------- */
.qr-card { text-align: center; }
.qr-box { width: min(240px, 70%); margin: 10px auto 0; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--line, #e3e6f0); }
.qr-box svg { display: block; width: 100%; height: auto; }
.inv-img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
@media (max-width: 460px) { .legend { gap: 6px; } .legend .lg-i { padding: 8px 1px; } .legend small { font-size: 10px; letter-spacing: -.3px; } .legend .lg-n { gap: 4px; font-size: 12.5px; } }

/* ===== v1.13.0 หน้าแรกสองปุ่ม + พนักงาน PR ===== */
.kinds { display: grid; gap: 12px; }
.kind { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: center; text-align: left; transition: transform .18s var(--spring), border-color .2s; }
.kind .k-ico { grid-row: 1 / span 2; font-size: 34px; line-height: 1; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--sun, #ffd23f); }
.kind.pr .k-ico { background: var(--sky, #bfe3ff); }
.kind b { font-size: 18px; }
.kind small { color: var(--ink-3); font-size: 13px; }
.kind:active { transform: scale(.97); }
.kind:hover { border-color: var(--sky); }
/* ปุ่มกลับ (หน้าเลือกชื่อ): อยู่บนซ้ายบรรทัดเดียวกับปุ่มภาษา/ธีม แสดงเฉพาะตอนมีรายชื่อ */
#backbtn { position: fixed; z-index: 30; top: calc(10px + var(--safe-t)); left: max(12px, env(safe-area-inset-left, 0px)); display: none; align-items: center; }
.person.done { opacity: .62; }
.person.done small { color: var(--ok, #1a7f4b); font-weight: 600; }
.pr-h input { width: 92px; text-align: center; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font: inherit; }
.pr-h input:focus { outline: 2px solid var(--sky); }

.pd-day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 8px; margin-bottom: 8px; }
.pd-all { background: #fff8cf; border-color: var(--sun); }
.pd-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.pd-h span { color: var(--ink-3); }
.pd-g { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.pd-c small { display: block; color: var(--ink-3); font-size: 11px; overflow-wrap: anywhere; }
.pd-c b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.person small.on { color: var(--sky); font-weight: 600; }
@supports not (overflow: clip) { html, body { overflow-x: hidden; } }
/* หน้าที่มีแท็บล่าง: ปุ่มภาษา/ธีมเลื่อนหายไปพร้อมหน้า ไม่ลอยทับการ์ดตอนเลื่อน */
body:has(.screen:not(.no-tabs)) #topbar { position: absolute; }
/* บัญชี: ชื่ออยู่บรรทัดเต็ม ปุ่มลงบรรทัดใหม่ ชื่อไม่ตกบรรทัดกลางคำ */
.row:has(> .me-btns) { flex-wrap: wrap; }
.row > .me-btns { flex-basis: 100%; display: flex; gap: 10px; justify-content: center; }
.me-btns .btn { min-width: 120px; }
/* รายชื่อพนักงาน: ป้ายสิทธิ์อยู่ใต้ชื่อ ชื่อได้เต็มบรรทัด ไม่ตกบรรทัดบนจอแคบ */
.emp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.emp-chips:empty { display: none; }
/* หัวหน้า (ตารางเวร ฯลฯ): จัดกึ่งกลางแนวตั้งเท่ากับปุ่มภาษา/ธีม */
.screen > .title:first-child { display: flex; align-items: center; min-height: 40px; margin-top: -6px; line-height: 1.2; }
@media (pointer: coarse) { .screen > .title:first-child { min-height: 44px; } }
/* ปุ่มกลับ: อยู่บนซ้าย บรรทัดเดียวกับปุ่มภาษา/ธีม หน้าตาเหมือนกัน */
#backbtn { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; height: 40px; min-height: 0; padding: 0 14px 0 10px; border-radius: 20px; border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--ink); font-weight: 700; font-size: 13.5px; box-shadow: 0 1px 4px rgba(22, 26, 61, .12); }
@media (pointer: coarse) { #backbtn { height: 44px; } }
body:has(.people) #backbtn { display: flex; }

/* v1.14.2 รูปปุ่มทีม */
.kind img.k-ico { width: 64px; height: 64px; padding: 0; object-fit: cover; display: block; background: none; box-shadow: 0 1px 4px rgba(22, 26, 61, .18); }

/* v1.14.6 ข้อความไม่ตกบรรทัดแปลกๆ บนจอแอนดรอยด์ */
.row .sub { text-wrap: balance; }
.row .name { text-wrap: balance; }
.mini-stats > * { flex-wrap: wrap; row-gap: 0; }
.mini-stats span { white-space: nowrap; }
.tc-sum small, .tc-sum span { white-space: nowrap; font-size: 12px; color: var(--ink-3); }
@media (max-width: 400px) {
  .row { gap: 10px; }
  .row .chip { font-size: 12px; padding: 2px 8px; }
}
