/* Live-app layer on top of design.css (the approved mockup design system).
   design.css sizes things for fixed artboards; this file makes them fill a real phone / browser. */
html, body { background: var(--bg); min-height: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--teal-dark); }
.hidden { display: none !important; }

/* ---------- phone app ---------- */
.app { height: 100dvh; max-width: 480px; margin: 0 auto; padding-top: max(14px, env(safe-area-inset-top)); background: var(--bg); }
.content { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-bottom: 20px; }
.content.scroll { overflow-y: auto; }
.tabbar { flex-shrink: 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.tab { cursor: pointer; background: none; border: 0; }
.view { display: flex; flex-direction: column; gap: 12px; }

/* dark screens (Screen 1 activate, Screen 7 staff sign-in) */
.app.dark { background: radial-gradient(120% 70% at 50% 0%, #15335a 0%, #0B2545 55%, #081b33 100%); color: #fff; }
.app.dark .brand .logo-mark { color: #fff; }
.app.dark .brand .logo { color: #fff; }
.app.dark .brand .logo .os { color: #E01E26; }
.app.dark .brand .logo-mark .logo-tick { stroke: var(--teal); }
.app.dark .brand .staff-app-icon { width: 40px; height: 40px; box-shadow: 0 1px 3px rgba(0,0,0,0.35); }
.app.dark .brand.worker-brand .logo-mark .logo-tick { stroke: #F5B731; }
.app.dark .brand.worker-brand .logo .os { color: #E01E26; }
.app.dark .brand .tag { background: rgba(16,144,142,0.18); border-color: rgba(45,212,191,0.45); color: #5eead4; }
.app.dark .page-title { color: #fff; }
.app.dark .page-sub { color: rgba(255,255,255,0.68); }
.dark-note { font-size: 11.5px; line-height: 1.5; color: rgba(255,255,255,0.55); text-align: center; }

/* scanner (Screens 1, 3, 4) */
.scanner { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 1 / 1.03;
  background: radial-gradient(80% 70% at 50% 40%, #2a3f5c 0%, #172638 60%, #111c2b 100%); }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .label { position: absolute; top: 12px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,0.85);
  font-size: 11px; font-weight: 750; letter-spacing: 0.1em; z-index: 3; }
.scanner .corners { position: absolute; inset: 16% 18%; z-index: 3; pointer-events: none; }
.scanner .corners i { position: absolute; width: 26px; height: 26px; border: 3px solid #5eead4; }
.scanner .corners i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.scanner .corners i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.scanner .corners i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.scanner .corners i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.scanner .scanline { position: absolute; left: 18%; right: 18%; top: 50%; height: 2px; background: #5eead4;
  box-shadow: 0 0 12px #5eead4; z-index: 3; animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%,100% { top: 22% } 50% { top: 78% } }
.scanner .idle { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2; }
.poster-tile { width: 46%; background: #fff; border-radius: 6px; padding: 10px 10px 8px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.35); transform: rotate(-2deg); }
.poster-tile .pt-brand { font-size: 9px; font-weight: 750; color: var(--navy); display: flex; gap: 4px; justify-content: center; align-items: center; }
.poster-tile .pt-brand b { background: var(--teal); color: #fff; font-size: 7px; padding: 1px 4px; border-radius: 3px; }
.poster-tile .pt-qr { width: 70%; margin: 8px auto; aspect-ratio: 1; background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29' shape-rendering='crispEdges'><path fill='%230B2545' d='M0,0h1v1h-1zM1,0h1v1h-1zM2,0h1v1h-1zM3,0h1v1h-1zM4,0h1v1h-1zM5,0h1v1h-1zM6,0h1v1h-1zM9,0h1v1h-1zM10,0h1v1h-1zM11,0h1v1h-1zM12,0h1v1h-1zM13,0h1v1h-1zM15,0h1v1h-1zM17,0h1v1h-1zM18,0h1v1h-1zM19,0h1v1h-1zM22,0h1v1h-1zM23,0h1v1h-1zM24,0h1v1h-1zM25,0h1v1h-1zM26,0h1v1h-1zM27,0h1v1h-1zM28,0h1v1h-1zM0,1h1v1h-1zM6,1h1v1h-1zM10,1h1v1h-1zM11,1h1v1h-1zM12,1h1v1h-1zM13,1h1v1h-1zM14,1h1v1h-1zM15,1h1v1h-1zM16,1h1v1h-1zM18,1h1v1h-1zM22,1h1v1h-1zM28,1h1v1h-1zM0,2h1v1h-1zM2,2h1v1h-1zM3,2h1v1h-1zM4,2h1v1h-1zM6,2h1v1h-1zM8,2h1v1h-1zM9,2h1v1h-1zM10,2h1v1h-1zM11,2h1v1h-1zM13,2h1v1h-1zM15,2h1v1h-1zM18,2h1v1h-1zM22,2h1v1h-1zM24,2h1v1h-1zM25,2h1v1h-1zM26,2h1v1h-1zM28,2h1v1h-1zM0,3h1v1h-1zM2,3h1v1h-1zM3,3h1v1h-1zM4,3h1v1h-1zM6,3h1v1h-1zM8,3h1v1h-1zM9,3h1v1h-1zM11,3h1v1h-1zM14,3h1v1h-1zM17,3h1v1h-1zM22,3h1v1h-1zM24,3h1v1h-1zM25,3h1v1h-1zM26,3h1v1h-1zM28,3h1v1h-1zM0,4h1v1h-1zM2,4h1v1h-1zM3,4h1v1h-1zM4,4h1v1h-1zM6,4h1v1h-1zM8,4h1v1h-1zM10,4h1v1h-1zM12,4h1v1h-1zM17,4h1v1h-1zM18,4h1v1h-1zM19,4h1v1h-1zM22,4h1v1h-1zM24,4h1v1h-1zM25,4h1v1h-1zM26,4h1v1h-1zM28,4h1v1h-1zM0,5h1v1h-1zM6,5h1v1h-1zM8,5h1v1h-1zM11,5h1v1h-1zM15,5h1v1h-1zM18,5h1v1h-1zM22,5h1v1h-1zM28,5h1v1h-1zM0,6h1v1h-1zM1,6h1v1h-1zM2,6h1v1h-1zM3,6h1v1h-1zM4,6h1v1h-1zM5,6h1v1h-1zM6,6h1v1h-1zM8,6h1v1h-1zM10,6h1v1h-1zM12,6h1v1h-1zM14,6h1v1h-1zM16,6h1v1h-1zM18,6h1v1h-1zM20,6h1v1h-1zM22,6h1v1h-1zM23,6h1v1h-1zM24,6h1v1h-1zM25,6h1v1h-1zM26,6h1v1h-1zM27,6h1v1h-1zM28,6h1v1h-1zM8,7h1v1h-1zM11,7h1v1h-1zM12,7h1v1h-1zM14,7h1v1h-1zM16,7h1v1h-1zM19,7h1v1h-1zM0,8h1v1h-1zM2,8h1v1h-1zM3,8h1v1h-1zM4,8h1v1h-1zM5,8h1v1h-1zM6,8h1v1h-1zM9,8h1v1h-1zM10,8h1v1h-1zM11,8h1v1h-1zM12,8h1v1h-1zM17,8h1v1h-1zM20,8h1v1h-1zM22,8h1v1h-1zM23,8h1v1h-1zM24,8h1v1h-1zM25,8h1v1h-1zM26,8h1v1h-1zM1,9h1v1h-1zM2,9h1v1h-1zM3,9h1v1h-1zM4,9h1v1h-1zM7,9h1v1h-1zM9,9h1v1h-1zM10,9h1v1h-1zM13,9h1v1h-1zM14,9h1v1h-1zM16,9h1v1h-1zM17,9h1v1h-1zM18,9h1v1h-1zM19,9h1v1h-1zM20,9h1v1h-1zM22,9h1v1h-1zM23,9h1v1h-1zM24,9h1v1h-1zM26,9h1v1h-1zM27,9h1v1h-1zM28,9h1v1h-1zM1,10h1v1h-1zM2,10h1v1h-1zM3,10h1v1h-1zM4,10h1v1h-1zM5,10h1v1h-1zM6,10h1v1h-1zM8,10h1v1h-1zM10,10h1v1h-1zM13,10h1v1h-1zM14,10h1v1h-1zM15,10h1v1h-1zM16,10h1v1h-1zM20,10h1v1h-1zM23,10h1v1h-1zM24,10h1v1h-1zM26,10h1v1h-1zM0,11h1v1h-1zM5,11h1v1h-1zM9,11h1v1h-1zM12,11h1v1h-1zM13,11h1v1h-1zM16,11h1v1h-1zM18,11h1v1h-1zM20,11h1v1h-1zM21,11h1v1h-1zM25,11h1v1h-1zM28,11h1v1h-1zM1,12h1v1h-1zM4,12h1v1h-1zM5,12h1v1h-1zM6,12h1v1h-1zM10,12h1v1h-1zM14,12h1v1h-1zM17,12h1v1h-1zM26,12h1v1h-1zM28,12h1v1h-1zM0,13h1v1h-1zM4,13h1v1h-1zM5,13h1v1h-1zM7,13h1v1h-1zM9,13h1v1h-1zM11,13h1v1h-1zM16,13h1v1h-1zM17,13h1v1h-1zM18,13h1v1h-1zM19,13h1v1h-1zM20,13h1v1h-1zM21,13h1v1h-1zM22,13h1v1h-1zM23,13h1v1h-1zM24,13h1v1h-1zM25,13h1v1h-1zM27,13h1v1h-1zM28,13h1v1h-1zM1,14h1v1h-1zM3,14h1v1h-1zM4,14h1v1h-1zM5,14h1v1h-1zM6,14h1v1h-1zM9,14h1v1h-1zM11,14h1v1h-1zM12,14h1v1h-1zM15,14h1v1h-1zM16,14h1v1h-1zM23,14h1v1h-1zM25,14h1v1h-1zM1,15h1v1h-1zM3,15h1v1h-1zM4,15h1v1h-1zM5,15h1v1h-1zM7,15h1v1h-1zM10,15h1v1h-1zM11,15h1v1h-1zM12,15h1v1h-1zM14,15h1v1h-1zM15,15h1v1h-1zM18,15h1v1h-1zM20,15h1v1h-1zM24,15h1v1h-1zM25,15h1v1h-1zM27,15h1v1h-1zM28,15h1v1h-1zM2,16h1v1h-1zM3,16h1v1h-1zM4,16h1v1h-1zM6,16h1v1h-1zM11,16h1v1h-1zM12,16h1v1h-1zM17,16h1v1h-1zM20,16h1v1h-1zM21,16h1v1h-1zM23,16h1v1h-1zM26,16h1v1h-1zM27,16h1v1h-1zM0,17h1v1h-1zM5,17h1v1h-1zM7,17h1v1h-1zM13,17h1v1h-1zM14,17h1v1h-1zM16,17h1v1h-1zM19,17h1v1h-1zM20,17h1v1h-1zM21,17h1v1h-1zM22,17h1v1h-1zM23,17h1v1h-1zM24,17h1v1h-1zM28,17h1v1h-1zM0,18h1v1h-1zM3,18h1v1h-1zM5,18h1v1h-1zM6,18h1v1h-1zM8,18h1v1h-1zM10,18h1v1h-1zM12,18h1v1h-1zM13,18h1v1h-1zM14,18h1v1h-1zM15,18h1v1h-1zM20,18h1v1h-1zM21,18h1v1h-1zM24,18h1v1h-1zM25,18h1v1h-1zM26,18h1v1h-1zM0,19h1v1h-1zM2,19h1v1h-1zM7,19h1v1h-1zM8,19h1v1h-1zM9,19h1v1h-1zM11,19h1v1h-1zM13,19h1v1h-1zM15,19h1v1h-1zM16,19h1v1h-1zM19,19h1v1h-1zM21,19h1v1h-1zM24,19h1v1h-1zM25,19h1v1h-1zM27,19h1v1h-1zM0,20h1v1h-1zM2,20h1v1h-1zM3,20h1v1h-1zM4,20h1v1h-1zM6,20h1v1h-1zM7,20h1v1h-1zM9,20h1v1h-1zM11,20h1v1h-1zM12,20h1v1h-1zM14,20h1v1h-1zM15,20h1v1h-1zM16,20h1v1h-1zM17,20h1v1h-1zM20,20h1v1h-1zM21,20h1v1h-1zM22,20h1v1h-1zM23,20h1v1h-1zM24,20h1v1h-1zM25,20h1v1h-1zM26,20h1v1h-1zM27,20h1v1h-1zM8,21h1v1h-1zM10,21h1v1h-1zM11,21h1v1h-1zM16,21h1v1h-1zM19,21h1v1h-1zM20,21h1v1h-1zM24,21h1v1h-1zM25,21h1v1h-1zM0,22h1v1h-1zM1,22h1v1h-1zM2,22h1v1h-1zM3,22h1v1h-1zM4,22h1v1h-1zM5,22h1v1h-1zM6,22h1v1h-1zM10,22h1v1h-1zM11,22h1v1h-1zM12,22h1v1h-1zM15,22h1v1h-1zM16,22h1v1h-1zM17,22h1v1h-1zM18,22h1v1h-1zM19,22h1v1h-1zM20,22h1v1h-1zM22,22h1v1h-1zM24,22h1v1h-1zM0,23h1v1h-1zM6,23h1v1h-1zM8,23h1v1h-1zM9,23h1v1h-1zM10,23h1v1h-1zM11,23h1v1h-1zM12,23h1v1h-1zM14,23h1v1h-1zM15,23h1v1h-1zM19,23h1v1h-1zM20,23h1v1h-1zM24,23h1v1h-1zM25,23h1v1h-1zM27,23h1v1h-1zM0,24h1v1h-1zM2,24h1v1h-1zM3,24h1v1h-1zM4,24h1v1h-1zM6,24h1v1h-1zM8,24h1v1h-1zM9,24h1v1h-1zM10,24h1v1h-1zM12,24h1v1h-1zM15,24h1v1h-1zM17,24h1v1h-1zM20,24h1v1h-1zM21,24h1v1h-1zM22,24h1v1h-1zM23,24h1v1h-1zM24,24h1v1h-1zM0,25h1v1h-1zM2,25h1v1h-1zM3,25h1v1h-1zM4,25h1v1h-1zM6,25h1v1h-1zM8,25h1v1h-1zM9,25h1v1h-1zM12,25h1v1h-1zM13,25h1v1h-1zM14,25h1v1h-1zM16,25h1v1h-1zM19,25h1v1h-1zM20,25h1v1h-1zM25,25h1v1h-1zM26,25h1v1h-1zM27,25h1v1h-1zM28,25h1v1h-1zM0,26h1v1h-1zM2,26h1v1h-1zM3,26h1v1h-1zM4,26h1v1h-1zM6,26h1v1h-1zM8,26h1v1h-1zM15,26h1v1h-1zM19,26h1v1h-1zM20,26h1v1h-1zM22,26h1v1h-1zM24,26h1v1h-1zM25,26h1v1h-1zM26,26h1v1h-1zM27,26h1v1h-1zM0,27h1v1h-1zM6,27h1v1h-1zM10,27h1v1h-1zM11,27h1v1h-1zM13,27h1v1h-1zM14,27h1v1h-1zM18,27h1v1h-1zM20,27h1v1h-1zM21,27h1v1h-1zM23,27h1v1h-1zM25,27h1v1h-1zM27,27h1v1h-1zM0,28h1v1h-1zM1,28h1v1h-1zM2,28h1v1h-1zM3,28h1v1h-1zM4,28h1v1h-1zM5,28h1v1h-1zM6,28h1v1h-1zM8,28h1v1h-1zM9,28h1v1h-1zM12,28h1v1h-1zM14,28h1v1h-1zM15,28h1v1h-1zM16,28h1v1h-1zM17,28h1v1h-1zM19,28h1v1h-1zM21,28h1v1h-1zM24,28h1v1h-1zM25,28h1v1h-1z'/></svg>") center/100% no-repeat; }
  repeating-conic-gradient(#0B2545 0 25%, #fff 0 50%) 0 0 / 22% 22%; border: 4px solid #fff; outline: 3px solid #0B2545; }
.poster-tile .pt-cap { font-size: 8px; color: var(--muted); letter-spacing: 0.06em; }
.permit-tile { width: 72%; aspect-ratio: 1.58; border-radius: 10px; background: linear-gradient(135deg, #f3b8c6, #e7a0b2);
  transform: rotate(-4deg); box-shadow: 0 12px 30px rgba(0,0,0,0.4); padding: 10px 12px; color: #4a1b28; position: relative; }
.permit-tile .wp { font-size: 9px; font-weight: 800; letter-spacing: 0.08em; }
.permit-tile .bars { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 18px;
  background: repeating-linear-gradient(90deg, #2b0f17 0 2px, transparent 2px 4px, #2b0f17 4px 5px, transparent 5px 8px); }
.scan-hint { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,0.7); font-size: 12px; z-index: 3; }
.scan-actions { display: flex; flex-direction: column; gap: 8px; position: sticky; bottom: 0; background: var(--bg); padding: 4px 0 8px; z-index: 5; }
.app.dark .scan-actions { background: transparent; }
.view.scanning > .timer, .view.scanning > .row-2, .view.scanning > .result-tick,
.view.scanning > .page-title, .view.scanning > .banner { display: none; }
.scan-actions .btn-primary { height: 52px; font-size: 17px; font-weight: 750; }
.app.dark .scan-actions .btn-outline { color: #fff; border-color: rgba(255,255,255,0.4); background: transparent; }
.app.dark .scan-actions .btn-primary { box-shadow: 0 4px 14px rgba(14,124,123,0.35); }
.scan-photo-link { display: block; text-align: center; margin-top: 2px; }
.app.dark .scan-photo-link { color: #5eead4; }


/* banners & checks */
.banner { border-radius: 14px; padding: 10px 14px; font-size: 13.5px; font-weight: 650; display: flex; gap: 10px; align-items: center; }
.banner.green { background: var(--green-soft); color: var(--green); border: 1px solid #bfe8d3; }
.banner.amber { background: var(--amber-soft); color: var(--amber); border: 1px solid #f5dca8; }
.banner.red { background: var(--red-soft); color: var(--red); border: 1px solid #f5c6c0; }
.banner.teal { background: var(--teal-soft); color: var(--teal-dark); border: 1px solid var(--teal-mid); }
.banner small { display: block; font-weight: 500; font-size: 12px; opacity: 0.85; }
/* Empty message slots were showing as a blank pink/red bar on iPhone (e.g. #coDetect). */
#detect:empty, #coDetect:empty, #actMsg:empty,
#siMsg:empty, #vMsg:empty, #cpMsg:empty, #invMsg:empty,
.banner:empty { display: none !important; }

/* Check-in / check-out confirmation */
.result-tick { width: 72px; height: 72px; border-radius: 50%; margin: 10px auto 0;
  background: var(--green-soft); border: 2px solid #bfe8d3;
  display: flex; align-items: center; justify-content: center;
  color: var(--green); font-size: 36px; font-weight: 750; line-height: 1; }
.result-tick.sm { width: 52px; height: 52px; font-size: 26px; margin-top: 0; }
.dotlive { width: 14px; height: 14px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(15,138,90,0.18); flex-shrink: 0; }
.checks { background: var(--green-soft); border: 1px solid #bfe8d3; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.checks .ck { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink); }
.checks .ck i { width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; font-style: normal; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.checks .ck.bad i { background: var(--red); }

/* user row */
.user-row { display: flex; align-items: center; gap: 12px; }
.user-row .nm { font-size: 17px; font-weight: 750; color: var(--navy); letter-spacing: -0.02em; }
.user-row .co { font-size: 12.5px; color: var(--muted); }
.avatar.init { background: linear-gradient(135deg, #14365E, #0E7C7B); }

/* stats tiles (Screens 5, 8, 9) */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; box-shadow: var(--shadow-sm); }
.tile .v { font-size: 20px; font-weight: 750; color: var(--navy); letter-spacing: -0.02em; }
.tile .k { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.tile .v.amber { color: var(--amber); } .tile .v.red { color: var(--red); }
.tile.left { text-align: left; padding: 10px 12px; }

/* segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #E9EEF3; border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 34px; border-radius: 10px; font-size: 13.5px; font-weight: 650; color: var(--muted); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.app.dark .seg { background: rgba(255,255,255,0.08); }

/* list rows */
.list { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.list .li { padding: 11px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.list .li:last-child { border-bottom: 0; }
.list .li.live { background: var(--teal-soft); }
.list .li.flag { background: #FFF8F3; }
.li .day { width: 50px; flex-shrink: 0; font-weight: 750; color: var(--navy); font-size: 14px; }
.li .day small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.li .lmain { flex: 1; min-width: 0; }
.li .t1 { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.li .t2 { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.li .t3 { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.li .sub { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.li .act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.section-h { font-size: 15px; font-weight: 750; color: var(--navy); margin-top: 4px; }
.section-k { font-size: 11px; font-weight: 750; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }

/* week nav */
.weeknav { display: flex; align-items: center; justify-content: space-between; }
.weeknav .wk { font-size: 16px; font-weight: 750; color: var(--navy); }
.chev { width: 36px; height: 36px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--navy); }
.chev:disabled { opacity: 0.35; }

/* big timer (Screen 4) */
.timer { text-align: center; }
.timer .k { font-size: 12px; font-weight: 750; letter-spacing: 0.08em; color: var(--muted); }
.timer .v { font-size: 46px; font-weight: 750; color: var(--navy); letter-spacing: -0.04em; line-height: 1.1; }
.timer .s { font-size: 13.5px; color: var(--muted); }
.kv { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-sm); }
.kv .k { font-size: 10.5px; font-weight: 750; letter-spacing: 0.07em; color: var(--muted); text-transform: uppercase; }
.kv .v { font-size: 15px; font-weight: 750; color: var(--navy); margin-top: 2px; }
.link-btn { background: none; border: 0; color: var(--teal-dark); font-weight: 650; font-size: 13.5px; padding: 6px; }

/* bottom sheet / modal */
.sheet-bg { position: fixed; inset: 0; background: rgba(11,37,69,0.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 10px 18px max(18px, env(safe-area-inset-bottom)); max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: #D3DBE4; margin: 0 auto 12px; }
.sheet h3 { font-size: 17px; font-weight: 750; color: var(--navy); text-align: center; margin-bottom: 12px; }
.opt { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #F8FAFC; margin-bottom: 8px; width: 100%; text-align: left; }
.opt .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--teal-soft); color: var(--teal-dark); display: flex; align-items: center; justify-content: center; }
.opt .ic svg { width: 20px; height: 20px; }
.opt b { display: block; color: var(--navy); font-size: 14px; } .opt small { color: var(--muted); font-size: 12px; }
.modal-bg { position: fixed; inset: 0; background: rgba(11,37,69,0.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; padding: 20px 22px; box-shadow: var(--shadow); max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.modal.modal-wide { max-width: 1080px; width: min(1080px, 96vw); }
.modal h3 { font-size: 17px; font-weight: 750; color: var(--navy); margin-bottom: 4px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; align-items: center; }
textarea.input { height: 70px; padding: 10px 14px; resize: vertical; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13.5px; z-index: 80; max-width: 90vw; box-shadow: var(--shadow); }

/* time picker (manual check-out) */
.tpick { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.tpick select { font-size: 24px; font-weight: 750; color: var(--navy); border: 0; background: none; appearance: none; text-align: center; width: 54px; }
.tpick .colon { font-size: 22px; font-weight: 750; color: var(--navy); }

/* staff sign-in (Screen 7) */
.face-ring { width: 150px; height: 150px; border-radius: 50%; margin: 6px auto 0; border: 3px solid #2dd4bf;
  box-shadow: 0 0 0 10px rgba(45,212,191,0.12); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: rgba(255,255,255,0.04); }
.face-ring video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.face-ring .scanline { position: absolute; left: 12%; right: 12%; height: 2px; background: #5eead4; top: 40%; box-shadow: 0 0 10px #5eead4; }
.pin-dots { display: flex; gap: 14px; justify-content: center; }
.pin-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.55); }
.pin-dots i.on { background: #5eead4; border-color: #5eead4; }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 12px 22px; justify-content: center; }
.keypad button { height: 52px; border-radius: 26px; border: 0; background: rgba(255,255,255,0.1); color: #fff; font-size: 22px; font-weight: 500; }
.keypad button.small { font-size: 12.5px; }
.keypad button.blank { visibility: hidden; }
.keypad.locked button { opacity: 0.3; pointer-events: none; }
.lock-ic { width: 70px; height: 70px; border-radius: 50%; margin: 10px auto 0; background: rgba(192,57,43,0.25); border: 2px solid #f19a8f; display: flex; align-items: center; justify-content: center; color: #f19a8f; }
.lock-ic svg { width: 26px; height: 26px; }
.countdown { font-size: 34px; font-weight: 750; text-align: center; color: #fff; }

/* ---------- desktop admin ---------- */
.desk.live { height: 100vh; display: flex; }
.desk.live .sidebar { height: 100vh; }
.desk.live .main { flex: 1; min-width: 0; height: 100vh; display: flex; flex-direction: column; }
.desk.live .main-body { overflow: auto; }
.sb-item { cursor: pointer; }
.sb-item.disabled { opacity: 0.45; cursor: default; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-tab { border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.pill-tab.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill-tab.red { color: var(--red); border-color: #f1b8b0; }
.pill-tab.red.on { background: var(--red); color: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data tr.warn td { background: #FFF8EC; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: #F5F9FC; }
.who { display: flex; gap: 10px; align-items: center; }
.who b { display: block; color: var(--navy); font-size: 13px; } .who small { color: var(--muted); font-size: 11px; }
button.who-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.who-link:hover b { color: var(--teal-dark); text-decoration: underline; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 16px; }
.panel h4 { font-size: 14px; font-weight: 750; color: var(--navy); margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-qr { display: grid; grid-template-columns: 1fr 1.25fr; gap: 14px; }
.btn-out-red { background: #fff; color: var(--red); border: 1.5px solid #e9a79e; }
.btn-out { background: #fff; color: var(--navy); border: 1.5px solid var(--line-2); }
.lockbar { display: flex; align-items: center; gap: 10px; background: var(--red-soft); border: 1px solid #f1b8b0; color: var(--red); font-weight: 650; font-size: 13px; padding: 8px 12px; border-radius: 10px; }
.lockbar .sp { flex: 1; }
.ex-card { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ex-card:last-child { border-bottom: 0; }
.ex-card .t { font-weight: 750; color: var(--navy); font-size: 13.5px; }
.ex-card .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.ex-card .w { color: var(--muted-2); font-size: 11px; margin-top: 4px; }
.qrbox { width: 190px; height: 190px; margin: 4px auto; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.qrbox img { width: 100%; height: 100%; }
.detail-grid { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; }
.detail-grid .k { color: var(--muted); } .detail-grid .v { font-weight: 650; color: var(--navy); }
@media (max-width: 900px) { .grid-2, .grid-qr { grid-template-columns: 1fr; } .desk.live .sidebar { display: none; } }

.grid-ex { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 18px; align-items: start; }

/* ---------- admin desk on phones (<=900px): top bar + bottom tabs, stacked content ---------- */
.m-top, .m-tabs { display: none; }
@media (max-width: 900px) {
  .desk.live { height: 100dvh; flex-direction: column; overflow: hidden; }
  .desk.live .main { height: 100dvh; width: 100%; }
  .m-top { display: flex; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: var(--navy); color: #fff; flex-shrink: 0; }
  .m-top .brand .logo-mark { color: #fff; width: 22px; height: 25px; }
  .m-top .brand .logo-mark .logo-tick { stroke: var(--teal); }
  .m-top .brand .logo { color: #fff; font-size: 18px; }
  .m-top .brand .staff-app-icon { width: 28px; height: 28px; box-shadow: 0 1px 2px rgba(0,0,0,0.28); }
  .app-header .brand .staff-app-icon { width: 28px; height: 28px; }
  .m-top .brand .logo .os { color: #E01E26; }
  .m-top .brand .tag { background: rgba(16,144,142,0.25); border-color: rgba(143,224,222,0.35); color: #8FE0DE; }
  .m-who { display: flex; flex-direction: column; line-height: 1.2; margin-left: auto; text-align: right; min-width: 0; }
  .m-who b { font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
  .m-who span { font-size: 11px; color: rgba(255,255,255,0.6); }
  .m-btn { background: none; border: 1px solid rgba(255,255,255,0.3); color: #fff; border-radius: 8px; padding: 5px 9px; font-size: 12px; white-space: nowrap; }
  .m-tabs { display: flex; height: auto; padding: 6px 2px max(14px, env(safe-area-inset-bottom)); flex-shrink: 0; }
  .m-tabs .tab { font-size: 10.5px; letter-spacing: -0.02em; padding: 4px 0; }
  .desk.live .main-bar { height: auto; flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .desk.live .main-bar h1 { width: 100%; font-size: 17px; overflow-wrap: anywhere; }
  .desk.live .main-tools { width: 100%; flex-wrap: wrap; gap: 8px; }
  .desk.live .main-tools > * { max-width: 100%; }
  .desk.live .main-tools .search { flex: 1 1 160px; width: auto; min-width: 0; }
  .desk.live .main-tools select, .desk.live .main-tools .input { flex: 1 1 100%; min-width: 0; }
  .desk.live .main-body { padding: 12px 12px 20px; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .desk.live .main-body > *, .desk.live .panel { max-width: 100%; min-width: 0; }
  .desk.live .panel { padding: 14px; }
  .desk.live .main-body .flex-c, .desk.live .main-body .flex { flex-wrap: wrap; }
  .desk.live .main-body .grow { min-width: 0; flex-basis: 60%; }
  .desk.live .main-body [style*="margin-left:18px"] { margin-left: 0 !important; }
  .desk.live .main-body .qrbox { margin-left: auto; margin-right: auto; }
  .desk.live .main-body .grid-qr > .panel { align-items: stretch; }
  .desk.live .main-body .grid-qr > .panel > * { text-align: center; }
  .desk.live .main-body [data-pdf], .desk.live .main-body #regen { flex: 1 1 100%; width: 100%; justify-content: center; }
  .desk.live .main-body .pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .desk.live .main-body .pill-tab { flex-shrink: 0; }
  .desk.live .vc-card .vc-main { min-width: 0; flex-basis: 100%; }
  .desk.live .vc-card .vc-actions { flex-wrap: wrap; }
  .desk.live .main-body input, .desk.live .main-body select { max-width: 100%; }
  .desk.live .viewer-bar .vb-sub { flex-basis: 100%; order: 3; }
  .desk.live .grid-ex { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .desk.live .ex-card { flex-wrap: wrap; }
  .desk.live .ex-card .grow { flex: 1 1 60%; min-width: 0; }
  .desk.live .ex-card > .flex { flex: 1 1 100%; justify-content: flex-end; }
  .desk.live .row-2 > *, .desk.live .field, .desk.live .field .input { min-width: 0; }
  .desk.live input[type=date] { width: 100%; -webkit-appearance: none; appearance: none; }
}
@media (max-width: 700px) {
  /* tables -> stacked cards (labels come from the header row, set in staff.js labelTables) */
  .desk.live .table-wrap:has(> table.data) { background: none; border: 0; box-shadow: none; overflow: visible; }
  .desk.live .panel .table-wrap { margin: 0; }
  .desk.live table.data, .desk.live table.data tbody { display: block; width: 100%; background: none; }
  .desk.live table.data tr.th-row { display: none; }
  .desk.live table.data tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
  .desk.live .panel table.data tr { box-shadow: none; }
  .desk.live table.data tr.warn { background: #FFF8EC; } .desk.live table.data tr.warn td { background: none; }
  .desk.live table.data td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: right; overflow-wrap: anywhere; min-width: 0; white-space: normal !important; }
  .desk.live table.data tr td:last-child { border-bottom: 0; }
  .desk.live table.data td::before { content: attr(data-label); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); text-align: left; flex-shrink: 0; max-width: 45%; }
  .desk.live table.data td[data-label=""]::before { content: none; }
  .desk.live table.data td[data-label=""] { justify-content: flex-start; text-align: left; }
  .desk.live table.data td:first-child { justify-content: flex-start; text-align: left; }
  .desk.live table.data td:first-child::before { content: none; }
  .desk.live table.data td:empty { display: none; }
  .desk.live table.data td .btn-sm, .desk.live table.data td > button:not(.link-btn) { flex: 1; }
  .desk.live table.data td[data-label=""] .btn-sm { width: 100%; height: 38px; }
  /* v14f: same stacked cards inside the Working hours modal (it is outside .desk.live), so the
     Status and Edit columns are not pushed off the right edge of a phone screen. */
  .tbl-cards .table-wrap:has(> table.data) { background: none; border: 0; box-shadow: none; overflow: visible; }
  .tbl-cards table.data, .tbl-cards table.data tbody { display: block; width: 100%; background: none; }
  .tbl-cards table.data tr.th-row { display: none; }
  .tbl-cards table.data tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
  .tbl-cards table.data td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: right; overflow-wrap: anywhere; min-width: 0; white-space: normal !important; }
  .tbl-cards table.data tr td:last-child { border-bottom: 0; }
  .tbl-cards table.data td::before { content: attr(data-label); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); text-align: left; flex-shrink: 0; max-width: 45%; }
  .tbl-cards table.data td[data-label=""]::before { content: none; }
  .tbl-cards table.data td[data-label=""] { justify-content: flex-start; text-align: left; }
  .tbl-cards table.data td:empty { display: none; }
  .tbl-cards table.data td[data-label=""] .btn-sm { width: 100%; height: 38px; }
}
.att-history { border-top: 1px solid var(--line); padding-top: 8px; max-height: 220px; overflow-y: auto; }
.att-hist-row { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.att-hist-row:last-child { border-bottom: 0; }

/* Viewer access code (read-only) */
.viewer-note { margin: 0 18px; padding: 10px 12px; border-radius: 12px; background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(245, 158, 11, 0.35); color: #fcd9a0; font-size: 12.5px; line-height: 1.45; text-align: center; }
.viewer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 14px; background: var(--amber-soft); color: var(--amber); border-bottom: 1px solid rgba(180, 83, 9, 0.25); font-size: 13px; }
.app > .viewer-bar { margin: -6px 0 6px; border-radius: 0; }
.viewer-bar b { font-weight: 750; }
.viewer-bar .vb-sub { color: #8a5a12; font-size: 12px; }
.viewer-bar .vb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.viewer-bar .vb-out { margin-left: auto; background: none; border: 1px solid rgba(180, 83, 9, 0.4); color: var(--amber); border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
body.viewer .btn-approve, body.viewer .btn-reject, body.viewer .btn-out-red, body.viewer .btn-primary, body.viewer .btn-navy,
body.viewer .btn-danger:not(#so), body.viewer [data-pdf], body.viewer [data-rv], body.viewer [data-so], body.viewer [data-ul],
body.viewer #xgo, body.viewer #sweep, body.viewer #regen, body.viewer #amend, body.viewer #newp, body.viewer #pre, body.viewer #xcsv, body.viewer #hCsv, body.viewer #matCsv, body.viewer [data-deliver], body.viewer [data-adv] { display: none !important; }
.vc-card { border: 1px solid var(--line, #e5e7eb); border-radius: 14px; padding: 14px 16px; background: #fff; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.vc-card .vc-main { flex: 1; min-width: 260px; }
.vc-card .vc-actions { display: flex; gap: 8px; align-items: center; }

/* Working hours (Staff registry) */
.hours-filters { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto; gap: 10px; align-items: end; }
.hours-filters .field { margin-bottom: 0; }
.hours-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.hours-chip { background: var(--bg, #F3F6F9); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 110px; }
.hours-chip .v { font-size: 18px; font-weight: 750; color: var(--navy); line-height: 1.2; }
.hours-chip .k { font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }
@media (max-width: 700px) {
  .hours-filters { grid-template-columns: 1fr 1fr; }
  .modal.modal-wide { max-width: 100%; width: 100%; padding: 16px 14px; border-radius: 16px 16px 0 0; }
}


/* ---------- materials review ---------- */
.mat-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.mat-filters .field { margin: 0; min-width: 0; }
.mat-filters .field label { font-size: 10.5px; }
.mat-filters .input, .mat-filters select.input { height: 36px; width: auto; min-width: 110px; }
.mat-filters .search { flex: 1 1 160px; min-width: 140px; }
.mat-sums { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.mat-sum { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.mat-sum .nm { font-weight: 700; color: var(--navy); font-size: 14px; }
.mat-sum .last { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.mat-sum .counts { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mat-group { margin-top: 16px; }
.mat-group h3 { font-size: 15px; font-weight: 700; color: var(--navy); margin: 0 0 8px; }
tr.mat-row { cursor: pointer; }
@media (max-width: 700px) {
  .tabbar-sup .tab span { font-size: 9.5px; }
}

/* ---- v12: permit photos (approvals + Staff registry > Permit scans) ---- */
.permit-thumb { width: 96px; height: 62px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: #F1F5F9;
  overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 0; cursor: zoom-in; color: #64748B; font-size: 11px; }
.permit-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.permit-thumb-sm { width: 64px; height: 42px; }
.permit-thumb-lg { width: 100%; height: auto; aspect-ratio: 1.58; max-height: 260px; }
.permit-thumb.ph-none, .permit-thumb.ph-hidden { cursor: default; flex-direction: column; gap: 2px; text-align: center; line-height: 1.2; padding: 4px; }
.permit-thumb.ph-hidden { background: #FFF7E6; border-color: #F5D9A8; color: #92400E; font-weight: 600; }
.permit-thumb.ph-hidden svg { width: 12px; height: 12px; }
.permit-sheet-ph { display: flex; flex-direction: column; gap: 6px; }
.permit-full { background: #0F172A; border-radius: 10px; min-height: 180px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.permit-full img { max-width: 100%; max-height: 70vh; display: block; }
.ps-table td { vertical-align: top; }
.ps-table tr.ps-deleted td { opacity: 0.6; }
.ps-table .badge { margin: 0 2px 2px 0; }
.ps-compare { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #F8FAFC; }
.ps-cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ps-cmp-col .permit-full { min-height: 220px; }
.detail-grid .v.ps-diff, .ps-diff { background: #FEE2E2; color: #B91C1C !important; border-radius: 4px; padding: 0 4px; font-weight: 700; justify-self: start; }
@media (max-width: 720px) { .ps-cmp-grid { grid-template-columns: 1fr; } }

/* ---- v12: invite link dialog (Copy / Share / WhatsApp) ---- */
.invite-url { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
  font-weight: 600; line-height: 1.4; word-break: normal; overflow-wrap: anywhere; resize: none !important;
  overflow: hidden; cursor: text; min-height: 88px; }
.invite-url::-webkit-resizer { display: none; }
.invite-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.invite-actions .btn { height: 48px; font-size: 16px; font-weight: 700; }
.invite-share { display: flex; gap: 8px; }
.invite-share .btn { flex: 1; width: auto; }
.invite-share .btn[hidden] { display: none !important; }


/* Worker language toggle (EN | 中文) */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 28px;
  padding: 2px 3px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.lang-toggle button {
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.2;
  min-width: 28px;
}
.lang-toggle button.on {
  background: var(--navy);
  color: #fff;
}
.lang-toggle .lang-sep {
  color: var(--line-2);
  font-size: 11px;
  padding: 0 1px;
  font-weight: 600;
}
.app.dark .lang-toggle {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
}
.app.dark .lang-toggle button { color: rgba(255,255,255,0.68); }
.app.dark .lang-toggle button.on { background: #fff; color: var(--navy); }
.app.dark .lang-toggle .lang-sep { color: rgba(255,255,255,0.35); }
.link-btn { white-space: normal; }
.btn { padding: 0 12px; text-align: center; }

.lang-toggle.lang-menu-wrap { position: relative; padding: 0; height: auto; background: transparent; border: 0; }
.lang-toggle .lang-current {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  line-height: 1.2;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app.dark .lang-toggle .lang-current {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 128px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(11,37,69,0.16);
  padding: 4px;
  z-index: 40;
}
.lang-menu .lang-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 10px;
}
.lang-menu .lang-opt.on { background: var(--teal-soft); color: var(--teal-dark); }
.lang-menu .lang-opt:hover { background: var(--teal-soft); }

/* Admin Translations page */
.tr-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tr-toolbar .input { height: 36px; max-width: 260px; }
.tr-miss { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--navy); margin-left: 4px; }
.tr-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.tr-table th, .tr-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
.tr-table th { position: sticky; top: 0; background: #f7f9fb; z-index: 2; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tr-table th.sticky-0, .tr-table td.sticky-0 { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 160px; }
.tr-table th.sticky-1, .tr-table td.sticky-1 { position: sticky; left: 160px; background: #fff; z-index: 1; min-width: 220px; box-shadow: 4px 0 8px -6px rgba(11,37,69,0.25); }
.tr-table th.sticky-0, .tr-table th.sticky-1 { z-index: 3; background: #f7f9fb; }
.tr-table .tr-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--muted); word-break: break-all; }
.tr-table textarea { width: 100%; min-width: 180px; min-height: 58px; resize: vertical; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.tr-table textarea.missing { background: #fff8e8; }
.tr-table .tr-cell-tools { display: flex; gap: 6px; margin-top: 4px; }
.tr-src { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tr-src.override { color: var(--teal-dark); }
.tr-src.missing { color: var(--amber); }
.tr-src.default { color: var(--muted); }
.tr-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }


/* ---- v13: face setup photos (Admin staff record) + enrolment ticks + failed-sign-in hint ---- */
.face-ticks { display: flex; flex-direction: column; gap: 8px; max-width: 260px; margin: 12px auto 0; text-align: left; }
.face-tick { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.85); cursor: pointer; }
.face-tick input { width: 18px; height: 18px; accent-color: #0E7C7B; flex: none; }
.face-ticks.light .face-tick { color: var(--navy); }
.si-hint { text-align: center; margin: 8px 16px 0; color: #fde68a; font-weight: 650; font-size: 13.5px; line-height: 1.4; }
.face-thumb { width: 88px; height: 88px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: #F1F5F9;
  overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 0; cursor: zoom-in; color: #64748B; font-size: 11px; }
.face-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-thumb.ph-none, .face-thumb.ph-hidden { cursor: default; flex-direction: column; gap: 2px; text-align: center; padding: 6px; }
.face-thumb.ph-hidden { background: #FFF7E6; border-color: #F5D9A8; color: #92400E; font-weight: 600; }
.face-current { display: flex; gap: 14px; align-items: flex-start; }
.face-current .face-thumb { width: 120px; height: 120px; }
.face-ring.light { border-color: #0E7C7B; box-shadow: 0 0 0 8px rgba(14,124,123,0.12); background: #F0FDFA; }

/* ----- v14: attendance edit, translations search, claims ----- */
.att-voided { opacity: 0.7; }
.att-voided td { text-decoration: line-through; text-decoration-color: #c5c9d3; }
.att-voided .badge { text-decoration: none; }
.tr-search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.tr-search-bar #trQ { flex: 1; min-width: 200px; height: 40px; }
.tr-miss { display: flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; color: var(--ink); }
.hours-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.claim-form .claim-photos, .claim-thumbs-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.claim-thumb, .claim-thumbs-row img, .claim-thumb-img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f4f5f7; }
.claim-thumb { position: relative; }
.claim-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.claim-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: #111; color: #fff; cursor: pointer; line-height: 20px; }
.claim-pdf { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 8px; background: #EEF2FF; color: #3730A3; font-weight: 700; font-size: 12px; }
.claim-pdf.sm { width: 44px; height: 44px; font-size: 10px; }
.claim-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 10px; background: #fff; }
.claim-card.clickable { cursor: pointer; }
.claim-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.claim-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-weight: 700; white-space: nowrap; }
.claim-totals { margin: 0 0 10px; }
.claim-photo-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.claim-photo-lg { max-width: 220px; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.claim-photo-lg.pdf { display: inline-flex; align-items: center; padding: 16px 18px; background: #EEF2FF; color: #3730A3; font-weight: 600; text-decoration: none; }
.claim-ph { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.claim-thumbs-row .claim-ph, .claim-thumbs-row .claim-ph img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f4f5f7; }
.claim-thumbs-row .claim-ph .claim-pdf { border: 0; }
.claim-photo-grid .claim-ph { width: auto; }
/* v14e: claim detail sheet (card tap) and edit-claim form — receipts are constrained thumbnails;
   tapping one opens the fitted viewer (openPhotoViewer). Before v14e .claim-ph.lg had no size
   rule, so the receipt rendered at its native pixel size and overflowed the sheet. */
.claim-photo-grid .claim-ph.lg { position: relative; flex: 1 1 140px; max-width: 100%; min-height: 96px; max-height: 240px;
  border-radius: 10px; border: 1px solid var(--line); background: #f4f5f7; overflow: hidden; }
.claim-photo-grid .claim-ph.lg img { display: block; max-width: 100%; max-height: 240px; width: auto; height: auto; object-fit: contain; margin: 0 auto; }
.claim-photo-grid .claim-ph.lg::after { content: "⤢"; position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(11,37,69,0.72); color: #fff; font-size: 15px; line-height: 26px; text-align: center; pointer-events: none; }
.claim-photo-grid .claim-ph.lg .claim-pdf { width: 96px; height: 96px; }
.claim-form .claim-photos > .claim-ph, .claim-form .claim-photos > .claim-ph img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f4f5f7; overflow: hidden; }
/* v14e safety net: an image inside any sheet or modal never overflows its card. */
.sheet img, .modal img { max-width: 100%; height: auto; }
.sheet .claim-thumb img, .modal .claim-thumb img, .sheet .req-thumb img, .modal .req-thumb img,
.sheet .permit-thumb img, .modal .permit-thumb img, .sheet .face-thumb img, .modal .face-thumb img,
.sheet .claim-thumbs-row .claim-ph img, .modal .claim-thumbs-row .claim-ph img,
.claim-form .claim-photos > .claim-ph img { height: 100%; }
.claim-photo-full { max-width: 100%; max-height: min(70vh, 640px); border-radius: 10px; display: block; margin: 0 auto; }
.claim-pdf-frame { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.claim-full { min-height: 120px; text-align: center; }

/* v14c: uploading-photo overlay (above claim/permit/material forms) */
.upload-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(11, 37, 69, 0.72); display: flex; align-items: center; justify-content: center; padding: 24px; }
.upload-overlay-card { background: #fff; border-radius: 18px; padding: 28px 32px 26px; text-align: center; min-width: 240px; max-width: 320px; width: 100%; box-shadow: 0 18px 40px rgba(11, 37, 69, 0.28); }
.upload-overlay-title { font-weight: 750; color: var(--navy); font-size: 17px; line-height: 1.35; }
.upload-overlay-pct { font-size: 28px; font-weight: 800; color: var(--navy); margin-top: 8px; letter-spacing: -0.02em; }
.upload-spinner { width: 36px; height: 36px; border: 3px solid #D5DEE7; border-top-color: #0E7C7B; border-radius: 50%; margin: 0 auto 14px; animation: upload-spin 0.8s linear infinite; }
.upload-bar { height: 6px; background: #E8ECF2; border-radius: 99px; overflow: hidden; margin-top: 14px; }
.upload-bar > i { display: block; height: 100%; width: 0; background: #0E7C7B; border-radius: 99px; transition: width 0.2s ease; }
@keyframes upload-spin { to { transform: rotate(360deg); } }

/* v14d: fitted photo viewer (claims, permits, materials) */
.pv-overlay { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, 0.92); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  color: #fff; touch-action: none; -webkit-user-select: none; user-select: none; }
.pv-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 48px; }
.pv-title { font-weight: 750; font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.pv-count { flex: none; font-variant-numeric: tabular-nums; font-size: 14px; opacity: 0.85; }
.pv-x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,0.14); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.pv-x:active, .pv-tools button:active, .pv-nav:active { background: rgba(255,255,255,0.28); }
.pv-stage { flex: 1 1 auto; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; cursor: default; }
.pv-stage.pv-zoomed { cursor: grab; }
.pv-frame { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pv-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transform-origin: center center; will-change: transform; -webkit-user-drag: none; }
.pv-pdf { width: 100%; height: 100%; border: 0; background: #fff; }
.pv-load, .pv-err { color: rgba(255,255,255,0.85); font-size: 15px; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(0,0,0,0.5); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; z-index: 2; }
.pv-nav:disabled { opacity: 0.3; cursor: default; }
.pv-nav.prev { left: max(8px, env(safe-area-inset-left, 0px)); }
.pv-nav.next { right: max(8px, env(safe-area-inset-right, 0px)); }
.pv-tools { flex: none; display: flex; justify-content: center; gap: 8px; padding: 8px 12px max(10px, env(safe-area-inset-bottom, 0px)); }
.pv-tools button { min-width: 44px; height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(255,255,255,0.14); color: #fff; font-size: 16px; font-weight: 650; cursor: pointer; }
.pv-caption { flex: none; font-size: 12px; line-height: 1.4; opacity: 0.75; text-align: center; padding: 0 16px 10px; }
.claim-thread { display: flex; flex-direction: column; gap: 8px; }
.claim-note { background: #F7F8FA; border-radius: 10px; padding: 8px 10px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.row-end { display: flex; justify-content: flex-end; }
.danger { color: #B42318; }

/* v14f: desktop popups (Admin / GM / Manager desk shell, wider than a phone).
   Before v14f every sheet() was a phone bottom sheet even on a desktop: pinned to the bottom edge,
   480px wide, and its only height limit was 88dvh. Browsers without dvh support ignore that rule,
   so a tall sheet grew past the top of the window, and the fixed backdrop cannot scroll, leaving
   the top of the popup (title, Close) unreachable. Now: centred dialog, min(720px, 92vw) wide,
   at most 90vh tall with its own scrolling; title row and button row stay visible. Phone unchanged. */
@media (min-width: 701px) {
  body.desk-shell .sheet-bg, body.desk-shell .modal-bg { align-items: center; justify-content: center; padding: 4vh 2vw; overflow: hidden; }
  body.desk-shell .sheet-bg > .sheet, body.desk-shell .sheet-bg > .modal, body.desk-shell .modal-bg > .modal:not(.modal-wide), body.desk-shell .modal-bg > .sheet {
    width: min(720px, 92vw); max-width: min(720px, 92vw); max-height: 90vh; max-height: 90dvh; overflow-y: auto;
    border-radius: 16px; padding: 0 24px; box-shadow: var(--shadow); }
  body.desk-shell .modal-bg > .modal.modal-wide, body.desk-shell .sheet-bg > .modal.modal-wide { width: min(1080px, 94vw); max-width: min(1080px, 94vw);
    max-height: 90vh; max-height: 90dvh; overflow-y: auto; border-radius: 16px; padding: 0 24px; }
  body.desk-shell .sheet::before { display: none; }
  body.desk-shell .sheet h3 { text-align: left; }
  /* title row stays visible while the body scrolls */
  body.desk-shell .sheet-bg > div > :first-child, body.desk-shell .modal-bg > div > :first-child {
    position: sticky; top: 0; z-index: 3; background: #fff; padding-top: 18px; padding-bottom: 10px; margin-top: 0; }
  /* button row stays visible at the bottom */
  body.desk-shell .sheet-bg > div > .foot, body.desk-shell .modal-bg > div > .foot,
  body.desk-shell .sheet-bg > div > :last-child:has(> .btn, > .btn-sm), body.desk-shell .modal-bg > div > :last-child:has(> .btn, > .btn-sm) {
    position: sticky; bottom: 0; z-index: 3; background: #fff; display: flex; justify-content: flex-end; gap: 10px; align-items: center;
    flex-wrap: wrap; padding: 12px 0 18px; margin-top: 12px; border-top: 1px solid var(--line); }
  body.desk-shell .sheet-bg > div > :last-child:not(.foot):not(:has(> .btn, > .btn-sm)) { margin-bottom: 18px; }
  body.desk-shell .sheet .row-2 > .btn { height: 44px; }
}

/* v14f: Devices & access, one row per person with a name search per section */
.dv-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dv-search { height: 34px; width: 220px; max-width: 100%; font-size: 13px; }
.dv-row.click { cursor: pointer; }
.dv-row:hover td, div.dv-row:hover { background: var(--bg, #f6f8fa); }
.dv-count { margin-left: 4px; }

/* v14g: freelancer enrolment page */
.fl-enrol .field label { font-weight: 600; }
.field-err { color: var(--red, #c0392b); font-size: 12.5px; margin-top: 6px; line-height: 1.35; }
.input.invalid { border-color: var(--red, #c0392b); }
.user-row .badge { vertical-align: middle; margin-left: 6px; }

/* v14i: Admin "Delete permanently" dialog */
.pg-dialog { max-width: 520px; }
.pg-target { background: #FDF2F0; border: 1px solid #F1C9C2; border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.pg-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.pg-list li { padding: 3px 10px; background: #F8FAFC; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; }
.pg-list li b { display: inline-block; min-width: 26px; color: var(--red, #c0392b); }
.pg-list li.zero { color: #8A94A6; }
.pg-list li.zero b { color: #8A94A6; }
.pg-phrase { background: #FDF2F0; padding: 1px 6px; border-radius: 6px; }
.btn-sm:disabled, .btn-danger:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 520px) { .pg-dialog { max-width: 94vw; } .pg-list { font-size: 13px; } }
/* the long cascade list scrolls; the Cancel / Delete buttons stay in view at the bottom of the dialog */
.pg-dialog { padding-bottom: 0; }
.pg-dialog .foot { position: sticky; bottom: 0; margin: 16px -22px 0; padding: 12px 22px 18px; background: #fff; border-top: 1px solid var(--line, #e5e7eb); border-radius: 0 0 16px 16px; z-index: 2; }

/* v14j: EN/中文 toggle in the staff app (same .lang-toggle as the worker and freelancer pages) */
.sb-lang { padding: 8px 8px 2px; }
.sidebar .lang-toggle, .m-top .lang-toggle { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); }
.sidebar .lang-toggle button, .m-top .lang-toggle button { color: rgba(255,255,255,0.75); }
.sidebar .lang-toggle button.on, .m-top .lang-toggle button.on { background: #fff; color: var(--navy); }
.sidebar .lang-toggle .lang-sep, .m-top .lang-toggle .lang-sep { color: rgba(255,255,255,0.3); }
.m-top .lang-toggle { margin-left: 8px; }
@media (min-width: 901px) { .m-top .lang-toggle { display: none; } }
.app-header .hdr-lang { margin-left: auto; }
.today-lang { margin-right: 2px; }
.si-lang { margin-top: 2px; }

/* v14j: "Who to include?" popup before the timesheet export */
.ex-dialog { max-width: 520px; padding-bottom: 0; }
.ex-tools { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ex-tools .input { flex: 1 1 180px; height: 38px; min-width: 0; }
.ex-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 46vh; overflow-y: auto; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; }
.ex-list li { border-bottom: 1px solid var(--line, #e5e7eb); }
.ex-list li:last-child { border-bottom: 0; }
.ex-list label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; font-size: 14px; }
.ex-list label:hover { background: var(--bg, #f6f8fa); }
.ex-list input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--teal, #0E7C7B); }
.ex-list .ex-name { font-weight: 600; color: var(--navy); }
.ex-list .ex-sub { color: #6B7A90; font-size: 12px; margin-left: auto; white-space: nowrap; }
.ex-empty { padding: 16px; text-align: center; color: #6B7A90; font-size: 13px; }
.ex-dialog .foot { position: sticky; bottom: 0; margin: 14px -22px 0; padding: 12px 22px 18px; background: #fff; border-top: 1px solid var(--line, #e5e7eb); border-radius: 0 0 16px 16px; z-index: 2; }
@media (max-width: 520px) { .ex-dialog { max-width: 94vw; } .ex-list { max-height: 40vh; } }

/* v15a: company storage quota (only shown when the company copy has a quota; never on IDSS today) */
.sto-banner { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; text-align: left; padding: 9px 16px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.sto-banner svg { width: 18px; height: 18px; flex-shrink: 0; }
.sto-banner b { margin-left: auto; text-decoration: underline; font-weight: 650; }
.sto-banner.warn80 { background: #FFF6E0; color: #8A5A00; border-bottom: 1px solid #F2DDA4; }
.sto-banner.warn95, .sto-banner.full { background: #FDECEA; color: #A3261B; border-bottom: 1px solid #F1C9C2; }
.sto-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sto-head svg { width: 34px; height: 34px; color: var(--teal-dark, #0E7C7B); flex-shrink: 0; }
.sto-big { font-size: 22px; font-weight: 750; color: var(--navy); letter-spacing: -0.02em; }
.sto-bar { position: relative; height: 14px; border-radius: 999px; background: #EEF2F6; margin-top: 14px; overflow: hidden; }
.sto-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--teal, #0E7C7B); }
.sto-bar s { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(15, 30, 60, 0.25); }
.sto-panel.warn80 .sto-bar i { background: #E5A100; }
.sto-panel.warn95 .sto-bar i, .sto-panel.full .sto-bar i { background: #C0392B; }
.sto-msg { margin-top: 12px; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; background: #EAF6F4; color: #0B5E5D; }
.sto-msg.warn80 { background: #FFF6E0; color: #8A5A00; }
.sto-msg.warn95, .sto-msg.full { background: #FDECEA; color: #A3261B; }
.sto-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
