/* Elite Security guard app — navy and gold, high-contrast, glove-sized targets. */
:root {
  --bg: #0a1426;
  --card: #111f3a;
  --card-2: #182a4b;
  --line: #233658;
  --text: #eef2f9;
  --muted: #9aa8c2;
  --brand: #f5b82e;
  --brand-ink: #1c1300;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --blue: #60a5fa;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  min-height: 100dvh;
}
.view { max-width: 480px; margin: 0 auto; padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); }
h1 { font-size: 26px; margin: 12px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

/* ---------- login ---------- */
.login-head { text-align: center; padding: 8px 0 18px; }
.login-badge { width: min(62vw, 240px); height: auto; display: block; margin: 0 auto; }
.area-line { margin: 6px 0 0; color: var(--brand); font-weight: 700; letter-spacing: .04em; }
#form-login h1 { font-size: 21px; margin: 0 0 14px; }
#form-login label { display: block; margin-bottom: 16px; font-size: 14px; font-weight: 600; color: var(--muted); }
#form-login input:not([type=checkbox]) {
  display: block; width: 100%; margin-top: 6px;
  background: var(--card); border: 1.5px solid var(--line); color: var(--text);
  padding: 16px; border-radius: 14px; font-size: 20px;
}
#form-login input:focus { outline: none; border-color: var(--brand); }
.check { display: flex !important; align-items: center; gap: 12px; color: var(--text) !important; font-weight: 500 !important; }
.check input { width: 24px; height: 24px; accent-color: var(--brand); }
.error { margin-top: 14px; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.5);
         color: #fca5a5; padding: 12px 14px; border-radius: 12px; font-size: 15px; }

/* ---------- buttons ---------- */
button { font: inherit; cursor: pointer; border-radius: 14px; }
button:disabled { opacity: .6; }
.primary {
  width: 100%; border: 0; background: var(--brand); color: var(--brand-ink);
  padding: 16px; font-weight: 800; margin-top: 10px; font-size: 17px;
}
.primary.big { padding: 19px; font-size: 19px; }
.ghost { width: 100%; border: 1.5px solid var(--line); background: transparent; color: var(--text); padding: 15px; margin-top: 10px; font-weight: 600; }
.ghost.danger { color: #fca5a5; border-color: rgba(239,68,68,.4); }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(10,20,38,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-mark { width: 36px; height: 36px; object-fit: contain; flex: none; }
.top-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-mini { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-area { font-size: 12px; color: var(--brand); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { margin-left: auto; background: transparent; border: 1.5px solid var(--line);
           color: var(--text); width: 46px; height: 46px; display: grid; place-items: center; flex: none; }
.chip { font-size: 12px; font-weight: 700; padding: 4px 10px 4px 22px; border-radius: 999px; position: relative; flex: none; }
.chip::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: currentColor; }
.chip.ok { color: #86efac; background: rgba(34,197,94,.12); }
#topbar .chip { margin-left: auto; }
#topbar .iconbtn { margin-left: 0; }
.chip.off { color: #fca5a5; background: rgba(239,68,68,.14); }
#gps-chip { padding-left: 22px; }
.gps-banner { background: rgba(239,68,68,.14); border: 1px solid rgba(239,68,68,.5); color: #fecaca; border-radius: 14px; padding: 12px 14px; font-size: 15px; margin-bottom: 8px; }
.gps-banner b { display: block; color: #fff; margin-bottom: 2px; }
.rep-at { background: var(--card); border: 1.5px solid var(--brand); border-radius: 12px; padding: 10px 12px; font-weight: 700; margin: 0 0 12px; }
.client-sheet h2 { font-size: 24px; margin: 0; }
.cc-ok { color: #86efac; font-weight: 800; margin-bottom: 10px; }
.cc-kicker { color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .12em; margin: 0 0 2px; }
.cc-address { color: var(--muted); margin: 4px 0 12px; }
.cc-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cc-row span { color: var(--muted); }
.cc-call { display: block; text-align: center; text-decoration: none; color: var(--text); font-weight: 800; padding: 14px; margin-top: 8px; border-radius: 14px; background: var(--card-2); border: 1.5px solid var(--line); }
.cc-notes { margin-top: 10px; padding: 12px; border-radius: 12px; background: rgba(245,184,46,.1); border: 1px solid rgba(245,184,46,.35); color: #fde7b0; white-space: pre-wrap; }
.cc-place { margin-top: 12px; padding: 12px; border-radius: 14px; background: rgba(56,189,248,.08); border: 1px solid rgba(56,189,248,.35); }
.cc-place p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.cc-place .primary { width: 100%; }
.client-sheet .danger-btn { margin-top: 14px; }
.install-btn { border-color: var(--brand); color: var(--brand); font-weight: 800; }
a.help-btn { display: block; text-align: center; text-decoration: none; border-radius: 14px; }
.help-link { display: block; text-align: center; margin: 22px 0 0; color: var(--brand); font-weight: 700; font-size: 15px; text-decoration: none; }
.gps-meter { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 16px 0; text-align: center; }
.gps-meter-label { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.gps-meter-val { font-size: 34px; font-weight: 900; margin: 6px 0; }
.gps-meter-val.good { color: #86efac; }
.gps-meter-val.bad { color: #fcd34d; }

/* ---------- home ---------- */
.hello { padding: 6px 2px 0; }
.me-name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.me-code { color: var(--muted); font-size: 14px; margin-top: 2px; }

.stats { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.stats > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; }
.stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stats dd { margin: 4px 0 0; white-space: nowrap; font-size: clamp(16px, 5vw, 22px); font-weight: 800; font-variant-numeric: tabular-nums; }

.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 18px;
         background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px; }
.kind { padding: 13px 4px; background: transparent; border: 0; color: var(--muted); font-size: 15px; font-weight: 700; border-radius: 12px; }
.kind.active { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--brand); }
.kind[data-kind=clock_out].active { box-shadow: inset 0 0 0 1.5px #e2e8f0; }

.scanbtn {
  width: 100%; margin-top: 14px; padding: 34px 12px 30px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 24px; font-weight: 900; letter-spacing: -.01em;
  border: 0; border-radius: 26px; color: var(--brand-ink);
  background: var(--brand);
  box-shadow: 0 12px 34px rgba(245,184,46,.25);
}
.scanbtn.end { background: #e2e8f0; box-shadow: 0 12px 34px rgba(226,232,240,.15); color: #0a1426; }
.reportbtn {
  width: 100%; margin-top: 12px; padding: 17px 12px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 18px; font-weight: 800; color: #fecaca;
  background: rgba(239,68,68,.12); border: 2px solid rgba(239,68,68,.55); border-radius: 18px;
}
.reportbtn:active { transform: scale(.98); }
.scanbtn:active { transform: scale(.98); }
.queue-note { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(245,158,11,.12); color: #fcd34d; font-size: 15px; font-weight: 600; }

.log-card { margin-top: 24px; }
.log { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.log li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 14px 14px; border-bottom: 1px solid var(--line); font-size: 16px; }
.log li.muted { display: block; text-align: center; padding: 22px 14px; font-size: 15px; }
.log li:last-child { border-bottom: 0; }
.log .cp { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.tag.in { background: rgba(96,165,250,.16); color: #bfdbfe; }
.tag.out { background: rgba(245,158,11,.16); color: #fcd34d; }
.tag.cp { background: rgba(34,197,94,.14); color: #86efac; }
.tag.open { background: rgba(239,68,68,.16); color: #fecaca; }
.tag.done { background: rgba(34,197,94,.14); color: #86efac; }

/* ---------- report an issue (full screen) ---------- */
.fullsheet { position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow-y: auto; animation: up .2s ease-out; }
.fs-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px;
           padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.fs-head .iconbtn { margin: 0; }
.fs-head h2 { margin: 0; font-size: 20px; color: var(--text); text-transform: none; letter-spacing: 0; }
.fs-body { max-width: 480px; margin: 0 auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
.step { font-weight: 800; margin: 6px 0 10px; }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
       padding: 14px; min-height: 96px; background: var(--card); border: 2px solid var(--line); color: var(--text);
       font-size: 15px; font-weight: 700; line-height: 1.25; border-radius: 16px; }
.cat span { font-size: 28px; line-height: 1; }
.cat.active { border-color: var(--red); background: rgba(239,68,68,.12); }
.urgent-row { margin: 16px 0 6px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-weight: 700 !important; }
.urgent-row input { accent-color: var(--red); }
#rep-desc { width: 100%; background: var(--card); border: 1.5px solid var(--line); color: var(--text);
            padding: 14px; border-radius: 14px; font: inherit; font-size: 17px; resize: vertical; }
#rep-desc:focus { outline: none; border-color: var(--brand); }
.rep-extras { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.photo-btn { flex: 1; display: block; text-align: center; padding: 15px; border: 1.5px dashed var(--line); border-radius: 14px; font-weight: 700; cursor: pointer; }
#rep-photo-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.loc-line { color: var(--muted); font-size: 14px; margin: 12px 2px; }
.loc-line.ok { color: #86efac; }
.danger-btn { width: 100%; border: 0; background: var(--red); color: white; padding: 19px; font-size: 19px; font-weight: 800; margin-top: 8px; }
.danger-btn:disabled { opacity: .45; }

/* ---------- end-of-shift report ---------- */
.shift-stats { margin-bottom: 6px; }
.warn-box { border-color: var(--amber); }
.pick { display: flex; flex-direction: column; gap: 8px; }
.pick button { text-align: left; padding: 14px; background: var(--card); border: 2px solid var(--line); color: var(--text);
               font-size: 16px; font-weight: 700; border-radius: 14px; }
.pick button.active { border-color: var(--brand); background: rgba(245,184,46,.12); }
.quiet-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiet-btn { padding: 16px 10px; background: var(--card); border: 2px solid var(--line); color: var(--text); font-size: 16px; font-weight: 800; border-radius: 14px; }
.quiet-btn.active { border-color: var(--brand); background: rgba(245,184,46,.12); }
#sh-issues-box { margin-top: 12px; }
#sh-note { width: 100%; background: var(--card); border: 1.5px solid var(--line); color: var(--text);
           padding: 14px; border-radius: 14px; font: inherit; font-size: 17px; resize: vertical; }
#sh-note:focus { outline: none; border-color: var(--brand); }
#form-shift .primary.big { margin-top: 14px; }

/* ---------- sheets ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6);
           display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; background: var(--card);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { color: var(--text); text-transform: none; font-size: 20px; letter-spacing: 0; margin-bottom: 6px; }
.sheet .hint { margin-top: 8px; }
.cpname { font-size: 24px; font-weight: 800; margin: 4px 0 2px; }

/* ---------- scanner ---------- */
#scan-overlay {
  position: fixed; inset: 0; z-index: 50; background: black;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: relative; width: min(76vw, 320px); aspect-ratio: 1;
  border: 4px solid var(--brand); border-radius: 26px;
  box-shadow: 0 0 0 200vmax rgba(0,0,0,.5);
}
#scan-status {
  position: relative; z-index: 1; margin-top: 20px; color: white; font-weight: 600;
  background: rgba(0,0,0,.6); padding: 10px 16px; border-radius: 999px; font-size: 15px; text-align: center; max-width: 90vw;
}
.scan-actions { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 16px; right: 16px;
                display: flex; gap: 10px; justify-content: center; z-index: 1; }
.scan-actions .ghost { flex: 1; max-width: 200px; background: rgba(10,20,38,.88); border-color: rgba(255,255,255,.25); }
#btn-torch[data-on="1"] { background: rgba(245,158,11,.35); }

/* ---------- result (full screen so it reads at a glance) ---------- */
#result-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--card);
}
#result-overlay:has(.ok)  { background: #15803d; }
#result-overlay:has(.err) { background: #b91c1c; }
#result-overlay:has(.dup) { background: #b45309; }
#result-card { width: 100%; max-width: 380px; text-align: center; color: white; animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#result-icon {
  width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 64px; line-height: 1; font-weight: 900;
  background: rgba(255,255,255,.18);
}
#result-title { margin: 0 0 8px; font-size: 30px; font-weight: 900; letter-spacing: -.01em; color: white; text-transform: none; }
#result-sub { margin: 0; font-size: 18px; opacity: .92; }
.tap-hint { margin-top: 28px; font-size: 13px; opacity: .7; }

@media (min-width: 700px) { .view { padding-top: 40px; } }
