body { min-height: 100dvh; }
.app { max-width: 520px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }



.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: .6em; border-radius: 9px; font: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.cam { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3 / 4; }
.cam video, .cam img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam video.mirror { transform: scaleX(-1); }
.cam .frame { position: absolute; inset: 15%; border: 3px solid rgba(255,255,255,.85); border-radius: 18px; pointer-events: none; }
.cam .msg { position: absolute; left: 0; right: 0; bottom: 0; padding: .6rem; text-align: center; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }

.gps { display: flex; gap: .6rem; align-items: center; padding: .7rem .9rem; border-radius: 12px; background: var(--surface-2); }
.gps .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); flex: none; }
.gps.good .dot { background: var(--ok); } .gps.bad .dot { background: var(--bad); }
.place-list { display: grid; gap: .5rem; }
.place { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--text); width: 100%; }
.place.on { border-color: var(--brand); outline: 2px solid var(--brand); }
.place.far { opacity: .55; }
.place .d { margin-left: auto; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.done { text-align: center; padding: 2rem 0; }
.done .big-check { width: 88px; height: 88px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 3rem; color: #fff; background: #4caf50; }
.done .big-check.out { background: #009688; }


.day-row { display: flex; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.day-row .d { width: 4.6rem; flex: none; color: var(--muted); font-size: .9rem; }
.day-row .t { font-variant-numeric: tabular-nums; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-h { font-size: .8rem; color: var(--muted); padding: .2rem 0; }
.cal-d { border: 0; background: transparent; font: inherit; color: var(--text); padding: .35rem 0 .25rem; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; }
.cal-d:hover { background: var(--surface-2); }
.cal-d.today span { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 .45em; }
.cal-d i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.cal-d small { font-size: .65rem; line-height: 1; }

/* ---- look of the phone app: Kanit, teal top bar, drawer menu ---- */
body { font-family: "Kanit", "IBM Plex Sans Thai", system-ui, sans-serif; font-weight: 400; background: #ffffff; }
h1, h2, b, strong { font-weight: 500; }
.app h1 { color: var(--title); }
.ic { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ic svg, .icon-btn svg { width: 100%; height: 100%; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .25rem; margin: 0 -16px 1rem; padding: calc(6px + env(safe-area-inset-top)) 6px 6px; background: #009688; color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.18); }
.topbar .title { flex: 1; font-size: 1.15rem; font-weight: 500; padding-left: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { position: relative; border: 0; background: transparent; color: #fff; width: 44px; height: 44px; padding: 10px; border-radius: 50%; cursor: pointer; display: inline-flex; }
.icon-btn:active { background: rgba(255,255,255,.18); }
.icon-btn .badge, .drawer-list .badge { position: absolute; top: 4px; right: 2px; background: #f44336; color: #fff; border-radius: 999px; font-size: .68rem; line-height: 1.4; padding: 0 .4em; font-weight: 500; }

.drawer-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0); transition: background .2s; }
.drawer-wrap.open { background: rgba(0,0,0,.45); }
.drawer { position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 82vw); background: var(--surface); transform: translateX(-100%); transition: transform .2s ease-out; display: flex; flex-direction: column; box-shadow: 2px 0 12px rgba(0,0,0,.25); }
.drawer-wrap.open .drawer { transform: none; }
.drawer-head { background: #009688; color: #fff; padding: calc(20px + env(safe-area-inset-top)) 18px 16px; }
.drawer-head .brand-mark { color: #fff; margin-bottom: .8rem; }
.drawer-head .nm { font-size: 1.1rem; font-weight: 500; }
.drawer-head .code { color: #ffeb3b; font-size: .9rem; }
.drawer-head .co { font-size: .85rem; opacity: .9; }
.drawer-list { overflow-y: auto; padding: .4rem 0 calc(.4rem + env(safe-area-inset-bottom)); }
.drawer-list a { position: relative; display: flex; align-items: center; gap: 1.1rem; padding: .85rem 1.2rem; color: var(--text); text-decoration: none; }
.drawer-list a .ic { color: var(--muted); }
.drawer-list a.on { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.drawer-list a.on .ic { color: var(--brand); }
.drawer-list a .badge { position: static; margin-left: auto; font-size: .75rem; }

/* home */
.hero { background: #009688; color: #fff; margin: -1rem -16px 0; padding: .6rem 20px 3.4rem; }
.hero .hello { opacity: .85; font-size: .9rem; }
.hero .nm { font-size: 1.35rem; font-weight: 500; line-height: 1.3; }
.hero .code { color: #ffeb3b; font-weight: 500; }
.hero .co { opacity: .85; font-size: .85rem; }
.home-body { margin-top: -2.6rem; display: grid; gap: .9rem; }
.server-time { text-align: center; padding: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.server-time .lbl { display: inline-flex; align-items: center; gap: .4rem; color: var(--brand); font-weight: 500; }
.server-time .lbl .ic { width: 18px; height: 18px; }
.server-time .date { margin-top: .25rem; }
.server-time .tz { color: var(--muted); }
.server-time .tz b { color: var(--text); font-size: 1.6rem; font-weight: 500; letter-spacing: .02em; }
.add-note { justify-self: start; display: inline-flex; align-items: center; gap: .3rem; border: 0; background: transparent; color: var(--brand); font: inherit; font-weight: 500; padding: .2rem 0; cursor: pointer; }
.add-note .ic { width: 20px; height: 20px; }
.punch-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.punch-btn { width: 100%; min-height: 64px; border-radius: 10px; font: inherit; font-size: 1.15rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.punch-btn .ic { width: 24px; height: 24px; }
.punch-btn.in { background: #009688; color: #fff; border: 2px solid #009688; box-shadow: 0 2px 6px rgba(0,150,136,.35); }
.punch-btn.out { background: var(--surface); color: #009688; border: 2px solid #009688; }
.punch-btn:disabled { opacity: .5; cursor: default; }
.link-btn { justify-self: center; display: inline-flex; align-items: center; gap: .35rem; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; padding: .2rem; }
.link-btn .ic { width: 20px; height: 20px; }
.home-body .section-title { margin: .4rem 0 -.3rem; }
.timeline { padding: .6rem 1rem; }
.tl { display: flex; gap: .8rem; padding: .55rem 0; position: relative; }
.tl + .tl { border-top: 1px dashed var(--line); }
.tl i { width: 12px; height: 12px; border-radius: 50%; margin-top: .45rem; flex: none; background: #90a4ae; }
.tl.in i { background: #4caf50; } .tl.out i { background: #009688; } .tl.shift i { background: #ffb300; }
.tl.plan i { background: #29b6f6; } .tl.wait i { background: transparent; border: 2px solid #f44336; } .tl.wait b { color: #f44336; }
.tl b { font-variant-numeric: tabular-nums; }
.fab { position: fixed; right: max(18px, calc(50vw - 260px + 18px)); bottom: calc(22px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: #ff5722; color: #fff; display: flex; align-items: center; justify-content: center; padding: 15px; box-shadow: 0 4px 10px rgba(0,0,0,.3); z-index: 20; }

/* underline tabs (TimeMint style) */
.seg.utabs { background: transparent; padding: 0; gap: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.seg.utabs button { border-radius: 0; padding: .7em .3em; border-bottom: 3px solid transparent; box-shadow: none; }
.seg.utabs button.on { background: transparent; color: var(--brand); border-bottom-color: var(--brand); box-shadow: none; font-weight: 500; }

/* selfie camera as a pop-up after the place is chosen */
.cam-pop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.cam-sheet { width: 100%; max-width: 520px; background: var(--surface); border-radius: 18px 18px 0 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: .8rem; animation: cam-up .2s ease-out; }
.cam-sheet .cam { max-height: 62dvh; aspect-ratio: 3 / 4; margin: 0 auto; width: 100%; }
.cam-top { display: flex; align-items: center; gap: .5rem; }
.cam-top b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-top .icon-btn { color: var(--muted); }
@keyframes cam-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.install-card { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; }
.install-card img { border-radius: 10px; flex: none; }
.choice-list { display: grid; gap: .45rem; }
.choice-card { display: grid; gap: .1rem; text-align: left; padding: .6rem .75rem; border: 1.5px solid var(--line, #dfe6e8); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; }
.choice-card small { color: var(--muted, #6b7a80); }
.choice-card.on { border-color: var(--brand, #0f9b8e); background: #eef8f6; }
.choice-card:disabled { opacity: .45; cursor: not-allowed; }
.makeup-box { background: #eef8f4; border: 1px solid #cfe9df; border-radius: 10px; padding: .5rem .7rem; }
.check-row { display: flex; gap: .55rem; align-items: flex-start; margin-top: .6rem; cursor: pointer; }
.check-row input { width: auto; margin-top: .25rem; }
.drawer-ver { margin-top: auto; padding: .8rem 1.1rem 1.1rem; font-size: .78rem; color: var(--muted, #6b7a80); }
