:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #17212b;
  --muted: #4f5b66;
  --border: #e1e5ea;
  --primary: #0b6e4f;
  --primary-ink: #ffffff;
  --primary-soft: #e3f2ec;
  --ok: #17803d;
  --ok-soft: #e5f4e9;
  --warn: #a35c00;
  --warn-soft: #fff1dc;
  --danger: #c0262d;
  --danger-soft: #fdeaea;
  --info: #1e5bb8;
  --info-soft: #e7effb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --tabbar-h: 0px;
  --series-1: #2a78d6;
  --series-1-strong: #184f95;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --surface: #182026;
    --surface-2: #1e272e;
    --text: #e8edf1;
    --muted: #b3bec8;
    --border: #2a353d;
    --primary: #2fae84;
    --primary-ink: #04150f;
    --primary-soft: #133329;
    --ok: #4cc47a;
    --ok-soft: #14301f;
    --warn: #f0a646;
    --warn-soft: #36270f;
    --danger: #f06a6f;
    --danger-soft: #3a1a1c;
    --info: #6ea4f2;
    --info-soft: #172a45;
    --shadow: none;
    --series-1: #3987e5;
    --series-1-strong: #86b6ef;
    --series-2: #d95926;
    --series-3: #199e70;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Sarabun", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.12rem; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- chrome ---------- */
#topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--primary); color: var(--primary-ink);
}
#brand { width: 34px; height: 34px; border-radius: 9px; flex: none; box-shadow: 0 0 0 1.5px rgba(255,255,255,.55); }
#title { font-size: 1.2rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#who { font-size: .85rem; opacity: .9; white-space: nowrap; }
#main {
  max-width: 600px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-left: -8px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; cursor: pointer;
}
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- building blocks ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.card > h3, .card > .row > h3 { margin-bottom: 10px; }
.hero { border-top: 4px solid var(--primary); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.greet { margin: 0 0 12px; color: var(--muted); }
.section-title { margin: 22px 4px 8px; font-size: 1rem; color: var(--muted); font-weight: 600; }
.loading, .empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stack > * + * { margin-top: 10px; }
.link { color: var(--primary); font-weight: 600; font-size: .9rem; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.small { min-height: 42px; padding: 6px 12px; font-size: .95rem; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.badge.open { background: var(--info-soft); color: var(--info); }
.badge.closed { background: var(--warn-soft); color: var(--warn); }
.badge.verified { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: var(--surface-2); color: var(--muted); }
.badge.owner { background: var(--primary-soft); color: var(--primary); }

.diff { font-weight: 700; font-size: .95rem; white-space: nowrap; }
.diff.ok { color: var(--ok); }
.diff.over { color: var(--info); }
.diff.short { color: var(--danger); }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 1rem; display: block; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat span { display: block; font-size: .88rem; color: var(--muted); }
.stat b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.wide { grid-column: 1 / -1; }

/* lists */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 14px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
a.list-item:active, button.list-item:active { background: var(--surface-2); }
button.list-item { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.list-item:first-child { border-top: 0; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.li-sub { font-size: .92rem; color: var(--muted); overflow-wrap: anywhere; }
.li-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.li-amt { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.del { border: 0; background: none; color: var(--danger); padding: 6px; cursor: pointer; border-radius: 8px; }
.del svg { width: 18px; height: 18px; }

/* key-value rows */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px dashed var(--border); }
.kv:first-of-type { border-top: 0; }
.kv > :last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* reconciliation */
.recon { font-variant-numeric: tabular-nums; }
.rline { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.rline.sub { padding-left: 12px; color: var(--muted); }
.rline.strong { font-weight: 700; }
.rsep { border-top: 1px solid var(--border); margin: 6px 0; }
.rresult { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding: 12px 14px; border-radius: 12px; font-weight: 700; background: var(--surface-2); }
.rresult b { font-size: 1.4rem; }
.rresult.ok { background: var(--ok-soft); color: var(--ok); }
.rresult.over { background: var(--info-soft); color: var(--info); }
.rresult.short { background: var(--danger-soft); color: var(--danger); }

/* forms */
form { margin: 0; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.field small { display: block; color: var(--muted); font-size: .88rem; margin-top: 3px; }
.field small.calc { color: var(--primary); font-weight: 600; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.05rem;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
input[type=number] { font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-weight: 600; }
.check input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--primary); }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 1rem; font-weight: 600; margin: 0 0 12px; }
.meter-line { padding: 12px 0; border-top: 1px solid var(--border); }
.meter-line:first-of-type { border-top: 0; padding-top: 0; }
.meter-line .field { margin-bottom: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.chip { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 1rem; cursor: pointer; }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.filters .field { margin-bottom: 0; min-width: 0; }
.filters input { min-width: 0; padding-left: 8px; padding-right: 6px; }

/* sheet dialog */
dialog.sheet {
  width: 100%; max-width: 600px; max-height: 92vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 18px; } }
.sheet-form { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head .icon-btn { margin: 0 -8px 0 0; }

/* toasts */
#toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 560px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 1rem; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); color: #fff; }

/* auth pages */
.auth { max-width: 380px; margin: 6vh auto 0; }
.auth .logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 12px; }
.auth h2 { text-align: center; margin-bottom: 4px; }
.auth p.muted { text-align: center; margin-top: 0; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 4px; border-top: 1px solid var(--border); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; border-top: 0; font-size: .78rem; }
.scroll-x { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* ---------- home menu ---------- */
.status-strip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); line-height: 1.4;
}
.status-strip .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.status-strip.open { background: var(--info-soft); border-color: transparent; color: var(--info); }
.status-strip.open .dot { background: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 25%, transparent); }
.status-strip .small { color: var(--text); opacity: .8; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  min-height: 118px; padding: 16px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text); font: inherit; cursor: pointer;
}
.tile:active { transform: scale(.98); }
.tile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 92px; gap: 14px; }
.tile.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.tile-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 46px; height: 46px; border-radius: 14px; background: var(--primary-soft); color: var(--primary);
}
.tile-icon svg { width: 26px; height: 26px; }
.tile.primary .tile-icon { background: rgba(255,255,255,.18); color: var(--primary-ink); }
.tile-text { display: flex; flex-direction: column; min-width: 0; }
.tile-label { font-weight: 800; font-size: 1.12rem; line-height: 1.3; }
.tile.wide .tile-label { font-size: 1.3rem; }
.tile-sub { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.tile.primary .tile-sub { color: inherit; opacity: .85; }
.tile-count {
  position: absolute; top: 12px; right: 12px; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- pager (month / day) ---------- */
.pager { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.pager .icon-btn { margin: 0; width: 44px; height: 44px; background: var(--surface); border: 1px solid var(--border); color: var(--text); flex: none; }
span.icon-btn { visibility: hidden; }
.pager-label { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; }
.pager-date { text-align: center; font-weight: 600; }

/* ---------- dashboard ---------- */
.hero-num { font-size: 2.1rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hero-num small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.delta { display: block; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.stat .diff { font-size: 1rem; }
.readout { display: flex; flex-direction: column; min-height: 46px; margin-bottom: 4px; }
.readout b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.readout span { font-size: .92rem; color: var(--muted); }
.chart-host { width: 100%; overflow: hidden; touch-action: pan-y; }
.chart { display: block; outline: none; width: 100%; height: auto; stroke: none; stroke-width: 0; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart .bar { fill: var(--series-1); }
.chart .bar.sel { fill: var(--series-1-strong); }
.chart .avg { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; }
.chart-note { margin: 6px 0 0; }
.table-view { margin-top: 10px; }
.table-view summary { cursor: pointer; color: var(--primary); font-weight: 700; font-size: 1rem; padding: 6px 0; }
.paybar { display: flex; gap: 2px; height: 22px; margin-bottom: 10px; }
.seg { min-width: 3px; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:only-child { border-radius: 4px; }
.s1 { background: var(--series-1); }
.s2 { background: var(--series-2); }
.s3 { background: var(--series-3); }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.pct { width: 52px; text-align: right; color: var(--muted); }
.hbar { padding: 6px 0; }
.hbar-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.hbar-track { height: 8px; }
.hbar-fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.list.flat { border: 0; box-shadow: none; margin: 0 -14px -14px; border-radius: 0; }
.list.flat .list-item:first-child { border-top: 1px solid var(--border); }
a.kv { color: inherit; }

/* ---------- tasks ---------- */
.big-btn { min-height: 56px; font-size: 1.1rem; }
.big-btn svg, .btn svg { width: 22px; height: 22px; }
.tabs { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 4px; margin-bottom: 14px; overflow-x: auto; }
.tab { flex: 1; min-width: max-content; text-align: center; padding: 10px 12px; border-radius: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tab-count { display: inline-flex; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .8rem; align-items: center; justify-content: center; }
.badge.job-todo { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.badge.job-doing { background: var(--info-soft); color: var(--info); }
.badge.job-submitted { background: var(--warn-soft); color: var(--warn); }
.badge.job-redo { background: var(--danger-soft); color: var(--danger); }
.badge.job-approved { background: var(--ok-soft); color: var(--ok); }
.badge.job-cancelled { background: var(--surface-2); color: var(--muted); }
.badge svg { width: 14px; height: 14px; }
.inline-icon svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px; }
.li-note { margin-top: 4px; font-size: .92rem; color: var(--danger); font-weight: 600; }
.job-title { font-size: 1.45rem; margin: 10px 0 6px; overflow-wrap: anywhere; }
.job-desc { white-space: pre-wrap; margin: 12px 0 0; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 1.05rem; }
.audio-box { margin-top: 12px; }
.audio-box .small svg { width: 16px; height: 16px; vertical-align: -3px; }
audio { width: 100%; margin-top: 6px; }
.actions { margin-bottom: 14px; }
.actions > .grid2:first-child { margin-top: 0; }
.kv > :first-child { white-space: nowrap; }
.event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.event-head svg { width: 20px; height: 20px; }
.event-head .muted { flex-basis: 100%; }
.event-note { white-space: pre-wrap; margin: 8px 0 0; font-size: 1.05rem; }
.event.review-approved { border-left: 5px solid var(--ok); }
.event.review-approved .event-head { color: var(--ok); }
.event.review-redo { border-left: 5px solid var(--danger); }
.event.review-redo .event-head { color: var(--danger); }
.event.review-cancelled { border-left: 5px solid var(--muted); }
.warn-text { color: var(--warn); font-weight: 600; margin: 8px 0 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.photo-grid:empty { display: none; }
.photo { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); cursor: pointer; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-flag { position: absolute; left: 4px; bottom: 4px; right: 4px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 1px 4px; text-align: center; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.photo-remove svg { width: 18px; height: 18px; }
dialog.photo-view { width: 100%; max-width: 900px; padding: 12px; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); }
dialog.photo-view::backdrop { background: rgba(0,0,0,.8); }
dialog.photo-view img { width: 100%; border-radius: 10px; display: block; }
.photo-cap { margin-top: 8px; font-size: .95rem; color: var(--muted); }

/* segmented radio / checkbox */
.seg-group { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-group label { flex: 1; min-width: max-content; }
.seg-group input { position: absolute; opacity: 0; pointer-events: none; }
.seg-group span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font-weight: 700; cursor: pointer; }
.seg-group input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.seg-group input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.seg-group input:disabled + span { opacity: .6; cursor: default; }
.seg-group.days label { min-width: 0; }
.seg-group.days span { padding: 8px 0; }

/* recorder */
.rec-btn { width: 100%; border-style: dashed; border-width: 2px; }
.rec-live { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--danger-soft); }
.rec-live b { font-size: 1.3rem; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }
.rec-done .row { margin-top: 8px; }

/* in-app camera */
dialog.camera { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; display: flex; flex-direction: column; }
dialog.camera:not([open]) { display: none; }
dialog.camera::backdrop { background: #000; }
.cam-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam-frame { position: relative; overflow: hidden; background: #111; }
.cam-frame video, .cam-frame canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.cam-clock { position: absolute; left: 12px; bottom: 12px; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,.6); font-weight: 700; font-size: 1.05rem; }
.cam-msg { position: absolute; left: 16px; right: 16px; top: 40%; text-align: center; background: rgba(0,0,0,.75); padding: 14px; border-radius: 12px; font-size: 1.05rem; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom)); background: #000; }
.cam-btn { background: none; border: 0; color: #fff; font: inherit; font-size: 1.05rem; font-weight: 700; padding: 12px 6px; cursor: pointer; min-width: 88px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; cursor: pointer; flex: none; }
.shutter:active { transform: scale(.94); }
.cam-bar .btn.primary { min-height: 52px; padding: 0 28px; font-size: 1.1rem; }

.cam-torch { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; display: inline-flex; align-items: center; gap: 4px; padding: 9px 12px; border-radius: 999px; border: 2px solid rgba(255,255,255,.7); background: rgba(0,0,0,.5); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.cam-torch svg { width: 22px; height: 22px; }
.cam-torch.on { background: #ffd43b; border-color: #ffd43b; color: #000; }
.cam-torch.on svg { fill: #000; }
.cam-torch.unsupported { opacity: .55; }

/* voice note under text fields */
.voice-slot { margin-top: 8px; }
.voice-slot .rec-btn { min-height: 44px; font-size: .98rem; }
.audio-inline { display: block; width: 100%; max-width: 360px; height: 40px; margin-top: 6px; }

/* date (พ.ศ.) & 24h time display over native pickers */
.dt-wrap { position: relative; display: block; }
.dt-display { display: flex; align-items: center; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dt-display.placeholder { color: var(--muted); font-weight: 400; }
.dt-wrap.center .dt-display { justify-content: center; }
.dt-wrap input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.dt-wrap input:focus-visible + * , .dt-wrap:focus-within .dt-display { outline: 2px solid var(--primary); outline-offset: -1px; }

.cam-orient { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; display: flex; padding: 3px; border-radius: 999px; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.7); }
.cam-orient button { display: inline-flex; align-items: center; gap: 4px; padding: 7px 11px; border: 0; border-radius: 999px; background: none; color: #fff; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; }
.cam-orient button svg { width: 18px; height: 18px; }
.cam-orient button.active { background: #fff; color: #000; }
