/* Aditya Buildcon — worker app */
:root {
  --red: #C10E0E;
  --red-deep: #8F0707;
  --red-wash: #FBEAEA;
  --ink: #222325;
  --muted: #5D6168;
  --concrete: #ECEEF1;
  --line: #D5D8DD;
  --paper: #FFFFFF;
  --go: #17803D;
  --go-wash: #E3F4E8;
  --amber: #B86E00;
  --amber-wash: #FFF1D6;
  --font: "Barlow", "Roboto", system-ui, sans-serif;
  --cond: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; min-height: 100%; background: var(--concrete); color: var(--ink);
  font: 400 17px/1.45 var(--font); -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #1A66D2; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- App bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px 14px;
  background: var(--red); color: #fff; box-shadow: 0 2px 0 var(--red-deep);
}
.bar-mark { width: 40px; height: 40px; border-radius: 10px; background: #fff; display: grid; place-items: center; flex: none; }
.bar-mark img { width: 28px; height: auto; display: block; }
.bar-title { flex: 1; min-width: 0; line-height: 1.1; }
.bar-title strong { display: block; font: 700 20px/1.05 var(--cond); letter-spacing: .01em; }
.bar-title span { font-size: 14px; opacity: .85; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; }
.icon-btn:active { background: rgba(255,255,255,.18); }
.icon-btn svg { width: 24px; height: 24px; }
.net { font-size: 13px; padding: 3px 10px; border-radius: 99px; background: rgba(0,0,0,.25); white-space: nowrap; }

main { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; }
.view { animation: in .22s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Site board ---------- */
.siteboard {
  position: relative; background: var(--paper); border-radius: var(--r-md); padding: 16px 16px 14px 20px;
  border: 1px solid var(--line); overflow: hidden;
}
.siteboard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--red); }
.siteboard h1 { margin: 0; font: 700 28px/1.05 var(--cond); }
.siteboard p { margin: 4px 0 10px; color: var(--muted); font-size: 15px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-size: 15px; font-weight: 600; background: var(--concrete); color: var(--muted); }
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--go-wash); color: var(--go); }
.chip.bad { background: var(--red-wash); color: var(--red-deep); }
.chip.warn { background: var(--amber-wash); color: var(--amber); }
.chip.wait::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Clock ---------- */
.clock { padding: 22px 4px 10px; }
.clock-time { font: 700 96px/.9 var(--cond); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.clock-time small { font-size: 40px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.clock-date { margin-top: 8px; font-size: 18px; color: var(--muted); }

/* ---------- Cards & forms ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; margin-top: 14px; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.code-row { display: flex; gap: 10px; }
.input {
  width: 100%; min-height: 56px; padding: 0 14px; border-radius: var(--r-sm); border: 2px solid var(--line); background: #fff;
  font: 700 26px/1 var(--cond); letter-spacing: .06em; text-transform: uppercase;
}
.input:focus { border-color: var(--ink); outline: none; }
.hint { color: var(--muted); font-size: 15px; margin: 8px 0 0; }
.btn { min-height: 52px; padding: 0 20px; border-radius: var(--r-sm); border: 2px solid transparent; font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:active { background: #000; }
.btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.link { background: none; border: 0; color: var(--red); padding: 0 6px; min-height: 44px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.remembered { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Employee ---------- */
.emp-head { display: flex; gap: 14px; align-items: center; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font: 700 26px var(--cond); flex: none; }
.emp-head h2 { margin: 0; font: 700 30px/1.05 var(--cond); }
.emp-head p { margin: 2px 0 0; color: var(--muted); }
.shiftline { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 16px; }
.shiftline b { font: 700 20px var(--cond); white-space: nowrap; }
.today { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.today > div { background: var(--concrete); border-radius: var(--r-sm); padding: 10px 12px; }
.today span { display: block; font-size: 14px; color: var(--muted); }
.today b { font: 700 30px/1.1 var(--cond); font-variant-numeric: tabular-nums; }
.today em { display: block; font-style: normal; font-size: 14px; font-weight: 600; min-height: 1.2em; }
.today .late { color: var(--amber); }
.today .good { color: var(--go); }

.notice { margin-top: 14px; border-radius: var(--r-sm); padding: 12px 14px; font-size: 16px; display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--amber-wash); color: #6B4000; }
.notice.bad { background: var(--red-wash); color: var(--red-deep); }
.notice.ok { background: var(--go-wash); color: #0E5528; }
.notice.info { background: #E8EEF8; color: #23406B; }

/* The punch slab — the one big thing */
.slab {
  display: flex; align-items: flex-end; justify-content: space-between; width: 100%; min-height: 132px; margin-top: 18px;
  padding: 18px 20px; border: 0; border-radius: var(--r-lg); background: var(--red); color: #fff; text-align: left;
  box-shadow: 0 6px 0 var(--red-deep); transition: transform .08s, box-shadow .08s;
}
.slab:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--red-deep); }
.slab.out { background: var(--ink); box-shadow: 0 6px 0 #000; }
.slab.out:active { box-shadow: 0 2px 0 #000; }
.slab-verb { display: block; font: 700 52px/.9 var(--cond); white-space: nowrap; }
.slab-sub { display: block; font: 500 16px var(--font); opacity: .85; margin-top: 6px; }
.slab-time { font: 600 30px var(--cond); opacity: .9; font-variant-numeric: tabular-nums; }
.slab[disabled] { background: #9A9DA3; box-shadow: 0 6px 0 #7A7D83; }

.queue { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- Result ---------- */
.result { text-align: left; padding-top: 18px; }
.result-icon { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--go); color: #fff; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.result-icon.bad { background: var(--red); }
.result-icon.warn { background: var(--amber); }
.result-icon svg { width: 54px; height: 54px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.result h2 { font: 700 44px/1 var(--cond); margin: 18px 0 4px; }
.result .big-time { font: 700 72px/1 var(--cond); font-variant-numeric: tabular-nums; }
.result p { color: var(--muted); margin: 6px 0; font-size: 17px; }
.facts { margin: 16px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts li span { color: var(--muted); }
.facts li b { font-weight: 600; }
.result .actions { display: grid; gap: 10px; margin-top: 22px; }

/* ---------- Camera ---------- */
.cam { position: fixed; inset: 0; z-index: 50; background: #0E0F10; color: #fff; display: flex; flex-direction: column;
       padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.cam-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 18px; }
.cam-top h3 { margin: 0; font: 700 24px var(--cond); }
.cam-stage { position: relative; flex: 1; overflow: hidden; }
.cam-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-stage svg.guide { position: absolute; inset: 0; width: 100%; height: 100%; }
.guide .mask { fill: rgba(14,15,16,.62); }
.guide .ring { fill: none; stroke: #9A9DA3; stroke-width: 6; transition: stroke .2s; }
.guide.ok .ring { stroke: #3DDC84; }
.guide.adjust .ring { stroke: #FFB020; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flash .35s ease-out; }
@keyframes flash { 0% { opacity: .8; } 100% { opacity: 0; } }
.cam-msg { position: absolute; left: 16px; right: 16px; bottom: 18px; text-align: center; font: 700 30px/1.1 var(--cond); text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.cam-load { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; }
.cam-load p { font-size: 18px; margin: 12px 0 0; }
.bar-progress { width: 220px; height: 8px; border-radius: 9px; background: rgba(255,255,255,.18); overflow: hidden; margin: 0 auto; }
.bar-progress i { display: block; height: 100%; width: 0; background: #fff; transition: width .3s; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; list-style: none; margin: 0; padding: 12px 12px 14px; counter-reset: s; }
.steps li { counter-increment: s; text-align: center; font-size: 14px; color: #9A9DA3; padding-top: 8px; border-top: 4px solid #3A3C40; }
.steps li::before { content: counter(s) " "; font-weight: 700; }
.steps li.doing { color: #FFB020; border-color: #FFB020; }
.steps li.done { color: #3DDC84; border-color: #3DDC84; }
.steps li.fail { color: #FF6B6B; border-color: #FF6B6B; }
.samples { display: flex; gap: 8px; justify-content: center; padding: 12px; }
.samples i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; }
.samples i.on { background: #3DDC84; border-color: #3DDC84; }

/* ---------- Sheets / dialogs ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: #fff; border-radius: 20px 20px 0 0; padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }
.sheet h3 { margin: 4px 0 12px; font: 700 26px var(--cond); }
.menu-item { display: flex; width: 100%; align-items: center; gap: 14px; min-height: 56px; border: 0; background: none; text-align: left; font-size: 17px; border-bottom: 1px solid var(--concrete); padding: 0 4px; }
.menu-item svg { width: 22px; height: 22px; color: var(--muted); }
.menu-item small { display: block; color: var(--muted); font-size: 14px; }
.pin-input { letter-spacing: .5em; text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 80; max-width: calc(100% - 32px); font-size: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

/* ---------- Splash / empty ---------- */
.splash { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.splash img { width: min(320px, 80%); }
.splash p { color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-help { display: flex; gap: 16px; align-items: center; margin-top: 18px; }
.scan-help svg { width: 72px; height: 72px; flex: none; color: var(--red); }
ol.howto { padding-left: 22px; margin: 10px 0 0; }
ol.howto li { margin: 6px 0; }

@media (max-width: 360px) { .clock-time { font-size: 80px; } .slab-verb { font-size: 44px; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
