/* ============================================================
   Portal 2 — Camera-Locked National Verifier App (phone frame)
   ============================================================ */

.stage {
  min-height: calc(100vh - 56px); display: flex; align-items: flex-start; justify-content: center;
  gap: var(--s10); padding: var(--s8); flex-wrap: wrap;
}
.stage-aside { max-width: 320px; padding-block-start: var(--s8); }
.stage-aside h2 { font-size: var(--fs-h1); margin-block-end: var(--s3); }
.stage-aside p { color: var(--text-body); font-size: var(--fs-sm); margin-block-end: var(--s5); line-height: 1.7; }
.feature-li { display: flex; gap: var(--s3); margin-block-end: var(--s4); }
.feature-li .fic { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--bg-card); border: 1px solid var(--border); color: var(--emerald); }
.feature-li .fic svg { width: 16px; height: 16px; }
.feature-li b { font-family: var(--font-head); font-size: var(--fs-sm); display: block; }
.feature-li span { font-size: var(--fs-xs); color: var(--text-muted); }

/* Phone shell */
.phone {
  width: var(--phone-w); height: var(--phone-h); max-height: calc(100vh - 96px);
  border-radius: 44px; background: #05070C; padding: 11px;
  box-shadow: 0 0 0 2px #1b2233, 0 40px 80px -20px rgba(0,0,0,0.8); position: relative; flex: none;
}
.phone-screen {
  width: 100%; height: 100%; border-radius: 34px; overflow: hidden; position: relative;
  background: var(--bg-base); display: flex; flex-direction: column;
}
.phone-notch { position: absolute; top: 11px; inset-inline: 0; margin: auto; width: 132px; height: 26px; background: #05070C; border-radius: 0 0 16px 16px; z-index: 40; }

/* Status bar */
.statusbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px 6px; font-size: var(--fs-xs); font-family: var(--font-num); font-weight: 700; color: var(--text-primary); z-index: 30; }
.statusbar .sb-icons { display: flex; gap: 6px; align-items: center; }
.statusbar .sb-icons svg { width: 15px; height: 15px; }

.screen-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* ---- Nafath login screen ---- */
.login { height: 100%; display: flex; flex-direction: column; padding: 0 26px 28px; }
.login-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s4); }
.login-mark {
  width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dim));
  font-family: var(--font-head); font-weight: 800; font-size: 34px; color: #04130D;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 18px 40px -10px rgba(16,185,129,0.4);
}
.login h1 { font-size: 25px; letter-spacing: -0.02em; }
.login .tag { color: var(--text-body); font-size: var(--fs-sm); max-width: 250px; line-height: 1.6; }
.secure-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: var(--emerald-soft); border: 1px solid rgba(16,185,129,0.3); color: var(--emerald); font-size: var(--fs-xs); font-weight: 700; font-family: var(--font-head); }
.secure-pill svg { width: 13px; height: 13px; }

.login-actions { display: flex; flex-direction: column; gap: var(--s3); }
/* Nafath / UAE Pass SSO button */
.sso-btn {
  display: flex; align-items: center; gap: var(--s3); width: 100%; padding: 15px 18px;
  border-radius: var(--r-lg); background: var(--bg-card); border: 1px solid var(--border-strong);
  transition: all var(--dur) var(--ease); text-align: start;
}
.sso-btn:hover { border-color: var(--emerald); background: var(--bg-card-hover); }
.sso-btn .sso-logo { width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 13px; }
.sso-btn .sso-logo.nafath { background: #00843D; color: #fff; }
.sso-btn .sso-logo.uaepass { background: linear-gradient(135deg,#000,#1a1a1a); color: #fff; box-shadow: inset 0 0 0 1px #333; }
.sso-btn .sso-logo.kwt { background: linear-gradient(135deg,#007a3d,#ce1126); color: #fff; }
.sso-btn .sso-logo.qat { background: #8a1538; color: #fff; }
.sso-btn .sso-logo.bah { background: linear-gradient(135deg,#ce1126,#b30e20); color: #fff; }
.sso-btn .sso-logo.omn { background: linear-gradient(135deg,#db161b,#0b6623); color: #fff; }
.sso-btn .sso-txt b { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-body); display: block; }
.sso-btn .sso-txt span { font-size: var(--fs-xs); color: var(--text-muted); }
.sso-btn .sso-arrow { margin-inline-start: auto; color: var(--text-muted); width: 18px; height: 18px; }
[dir="rtl"] .sso-btn .sso-arrow { transform: scaleX(-1); }

.login-foot { text-align: center; font-size: var(--fs-micro); color: var(--text-faint); margin-block-start: var(--s5); line-height: 1.7; }
.divider-or { display: flex; align-items: center; gap: var(--s3); color: var(--text-faint); font-size: var(--fs-micro); letter-spacing: 0.1em; text-transform: uppercase; margin-block: var(--s2); }
.divider-or::before, .divider-or::after { content: ""; height: 1px; flex: 1; background: var(--border); }

/* ---- App chrome (after login) ---- */
.app-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 22px 14px; }
.app-top .who b { font-family: var(--font-head); font-size: var(--fs-body); display: block; }
.app-top .who span { font-size: var(--fs-micro); color: var(--text-muted); }
.app-top .av2 { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-strong); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 13px; }

/* Geofence ring + earnings header */
.geo-card { margin: 0 18px 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--bg-card); padding: var(--s4); display: flex; align-items: center; gap: var(--s4); }
.geo-ring { width: 56px; height: 56px; position: relative; flex: none; }
.geo-ring .pin { position: absolute; inset: 0; margin: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 4px var(--emerald-soft); }
.geo-card .geo-meta b { font-family: var(--font-num); font-weight: 800; font-size: 20px; }
.geo-card .geo-meta span { font-size: var(--fs-micro); color: var(--text-muted); display: block; letter-spacing: 0.04em; }

.feed-head { display: flex; align-items: center; justify-content: space-between; padding: 0 22px 10px; }
.feed-head h2 { font-size: var(--fs-h2); }
.feed { padding: 0 18px 90px; display: flex; flex-direction: column; gap: var(--s3); }

/* Job card */
.job {
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-card); padding: var(--s4);
  transition: all var(--dur) var(--ease); position: relative; overflow: hidden;
}
.job:active { transform: scale(0.99); }
.job .job-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); margin-block-end: var(--s3); }
.job .job-title { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-body); }
.job .job-addr { font-size: var(--fs-xs); color: var(--text-muted); margin-block-start: 2px; display: flex; align-items: center; gap: 4px; }
.job .pay { font-family: var(--font-num); font-weight: 800; font-size: 17px; color: var(--emerald); white-space: nowrap; }
.job .pay small { font-size: 10px; color: var(--text-muted); font-weight: 600; display: block; text-align: end; }
.job .job-foot { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.job .job-dist { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--text-body); font-family: var(--font-num); }
.job .job-dist svg { width: 12px; height: 12px; color: var(--emerald); }

/* Bottom tab bar */
.tabbar {
  position: absolute; inset-block-end: 0; inset-inline: 0; height: 64px; z-index: 35;
  background: rgba(11,15,25,0.92); backdrop-filter: blur(14px); border-block-start: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around; padding-block-end: 8px;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-muted); font-size: 9px; font-family: var(--font-head); font-weight: 600; }
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--emerald); }
.tab.cap-btn {
  width: 56px; height: 56px; border-radius: 50%; background: var(--emerald); color: #04130D;
  margin-block-start: -22px; box-shadow: 0 10px 24px -6px rgba(16,185,129,0.5), inset 0 0 0 4px var(--bg-base);
  justify-content: center;
}
.tab.cap-btn svg { width: 24px; height: 24px; }

/* ---- Anti-spoof capture screen ---- */
.capture { height: 100%; display: flex; flex-direction: column; background: #05070C; }
.cap-head { display: flex; align-items: center; gap: var(--s3); padding: 8px 18px 12px; color: #fff; }
.cap-head .back { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.08); display: grid; place-items: center; }
.cap-head .back svg { width: 17px; height: 17px; }
[dir="rtl"] .cap-head .back svg { transform: scaleX(-1); }
.cap-head b { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-body); }
.cap-head span { font-size: var(--fs-micro); color: var(--text-muted); display: block; }

/* Live camera viewer */
.viewfinder {
  flex: 1; margin: 0 16px; border-radius: var(--r-lg); position: relative; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 20%, #16324a 0%, #0c1a28 45%, #060c14 100%);
  border: 1px solid #1c2b3d;
}
.viewfinder::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 16px 16px; opacity: 0.5;
}
.vf-live { position: absolute; top: 12px; inset-inline-start: 12px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; background: rgba(0,0,0,0.55); font-size: 10px; font-weight: 700; color: #fff; font-family: var(--font-head); z-index: 6; }
.vf-live .live-dot { background: var(--red); }
.vf-hw { position: absolute; top: 12px; inset-inline-end: 12px; padding: 4px 9px; border-radius: 99px; background: rgba(0,0,0,0.55); font-size: 9px; color: var(--emerald); font-family: var(--font-num); font-weight: 700; z-index: 6; display: inline-flex; align-items: center; gap: 5px; }
.vf-hw svg { width: 11px; height: 11px; }
/* Reticle / focus frame */
.vf-frame { position: absolute; inset: 18%; border: 1px solid rgba(16,185,129,0.5); border-radius: var(--r-md); }
.vf-frame::before, .vf-frame::after,
.vf-frame i::before, .vf-frame i::after {
  content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--emerald);
}
.vf-frame::before { top: -1px; inset-inline-start: -1px; border-inline-end: none; border-block-end: none; border-radius: 6px 0 0 0; }
.vf-frame::after  { top: -1px; inset-inline-end: -1px; border-inline-start: none; border-block-end: none; border-radius: 0 6px 0 0; }
.vf-frame i::before { bottom: -1px; inset-inline-start: -1px; border-inline-end: none; border-block-start: none; border-radius: 0 0 0 6px; }
.vf-frame i::after  { bottom: -1px; inset-inline-end: -1px; border-inline-start: none; border-block-start: none; border-radius: 0 0 6px 0; }
.vf-scan { position: absolute; inset-inline: 18%; height: 2px; background: linear-gradient(90deg, transparent, var(--emerald), transparent); animation: scan 2.6s var(--ease) infinite alternate; }
.vf-watermark { position: absolute; inset-block-end: 12px; inset-inline-start: 12px; font-family: var(--font-num); font-size: 9px; color: rgba(255,255,255,0.6); line-height: 1.5; z-index: 6; }

/* Telemetry bar */
.telemetry { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 12px 16px 0; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.telemetry .tcell { background: var(--bg-card); padding: 10px 12px; }
.telemetry .tk { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-head); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.telemetry .tk svg { width: 11px; height: 11px; }
.telemetry .tv { font-family: var(--font-num); font-weight: 800; font-size: 15px; margin-block-start: 3px; }
.telemetry .tv small { font-size: 10px; color: var(--text-muted); font-weight: 600; }

/* Lock notice — anti-gallery enforcement */
.lock-note { display: flex; align-items: center; gap: var(--s2); margin: 10px 16px 0; padding: 9px 12px; border-radius: var(--r-md); background: var(--emerald-soft); border: 1px solid rgba(16,185,129,0.25); }
.lock-note svg { width: 15px; height: 15px; color: var(--emerald); flex: none; }
.lock-note span { font-size: var(--fs-xs); color: var(--emerald); font-weight: 600; line-height: 1.4; }
.lock-note.warn { background: var(--amber-soft); border-color: rgba(245,158,11,0.25); }
.lock-note.warn svg, .lock-note.warn span { color: var(--amber); }

/* Live video stream fills the viewfinder */
.vf-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #05070C; z-index: 1; }
.vf-video.is-live ~ .vf-frame, .vf-video.is-live ~ .vf-scan { z-index: 5; }
.viewfinder .vf-frame, .viewfinder .vf-scan, .viewfinder .vf-live, .viewfinder .vf-hw, .viewfinder .vf-watermark { z-index: 6; }

/* Camera/GPS status toast inside the viewfinder */
.cap-status { position: absolute; inset-block-end: 12px; inset-inline: 12px; z-index: 8;
  padding: 8px 12px; border-radius: var(--r-md); font-size: var(--fs-xs); font-weight: 700; font-family: var(--font-head);
  background: rgba(5,7,12,0.82); border: 1px solid var(--border-strong); color: var(--text-primary); text-align: center; }
.cap-status.em  { border-color: rgba(16,185,129,0.4);  color: var(--emerald); }
.cap-status.am  { border-color: rgba(245,158,11,0.4);  color: var(--amber); }
.cap-status.red { border-color: rgba(239,68,68,0.4);   color: var(--red); }

/* Telemetry payload preview */
.payload-card { margin: 10px 16px 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-inset); padding: 10px 12px; }
.payload-out { margin-top: 6px; font-family: var(--font-num); font-size: 10px; line-height: 1.5; color: var(--text-body);
  white-space: pre-wrap; word-break: break-all; max-height: 132px; overflow: auto; }

/* DEV simulate toggle (clearly marked, frontend-only aid) */
.dev-sim { padding: 7px 11px; border-radius: var(--r-md); font-size: 10px; font-weight: 700; font-family: var(--font-head);
  letter-spacing: 0.04em; color: var(--text-muted); background: var(--bg-inset); border: 1px dashed var(--border-strong); }
.dev-sim[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); border-style: solid; }

.cap-actions { padding: 14px 16px 18px; display: flex; align-items: center; gap: var(--s3); }
/* "Verify Delivery" shutter — disabled by default, armed only inside geofence */
.cap-shutter {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 13px 20px; border-radius: var(--r-lg);
  background: var(--border); color: var(--text-muted); font-family: var(--font-head); font-weight: 700; font-size: var(--fs-body);
  transition: all var(--dur) var(--ease); flex: none; cursor: not-allowed;
}
.cap-shutter svg { width: 17px; height: 17px; }
.cap-shutter[disabled] { opacity: 0.55; }
.cap-shutter.armed {
  background: var(--emerald); color: #04130D; cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(16,185,129,0.6), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.cap-shutter.armed:active { transform: scale(0.97); }

@media (max-width: 880px) { .stage-aside { display: none; } .stage { padding: var(--s4); } }
