:root{
  --bg:#f6f8fb;--card:#fff;--text:#172033;--muted:#64748b;--brand:#2563eb;--ok:#16a34a;--bad:#dc2626;--warn:#f59e0b;--line:#e5e7eb;
  --shadow:0 12px 30px rgba(15,23,42,.08);
}
*{box-sizing:border-box}
html,body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;background:var(--bg);color:var(--text)}
body{min-height:100vh}
.app-shell{max-width:540px;margin:0 auto;min-height:100vh;background:linear-gradient(180deg,#eff6ff 0,#f8fafc 180px);padding:18px 14px 90px}
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.brand{display:flex;gap:10px;align-items:center;font-weight:800}
.logo{width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,#ff9a1f,#ff4f7a,#e0009a);display:grid;place-items:center;color:white;font-size:22px;box-shadow:var(--shadow)}
.badge{font-size:12px;background:#dbeafe;color:#1d4ed8;border-radius:999px;padding:6px 10px}
.card{background:var(--card);border:1px solid var(--line);border-radius:22px;padding:18px;margin:12px 0;box-shadow:var(--shadow)}
h1{font-size:24px;margin:0 0 8px} h2{font-size:20px;margin:0 0 12px} h3{font-size:16px;margin:0 0 8px}
p{color:var(--muted);line-height:1.5}
label{display:block;font-size:13px;color:#334155;margin:12px 0 6px;font-weight:650}
input,select,textarea{width:100%;padding:13px 14px;border:1px solid #cbd5e1;border-radius:14px;font-size:16px;background:white}
textarea{min-height:92px;resize:vertical}
button{border:0;border-radius:14px;padding:13px 16px;font-weight:800;font-size:15px;background:#e2e8f0;color:#0f172a;cursor:pointer}
button.primary{background:var(--brand);color:white}
button.ok{background:var(--ok);color:white}
button.bad{background:var(--bad);color:white}
button.ghost{background:#eff6ff;color:#1d4ed8}
button:disabled{opacity:.45;cursor:not-allowed}
.row{display:flex;gap:10px}.row>*{flex:1}
.stack{display:grid;gap:10px}
.muted{color:var(--muted);font-size:13px}.center{text-align:center}
.status{padding:10px 12px;border-radius:14px;font-weight:700;margin-top:10px}
.status.ok{background:#dcfce7;color:#166534}.status.bad{background:#fee2e2;color:#991b1b}.status.warn{background:#fef3c7;color:#92400e}
.permission-list{display:grid;gap:10px}.perm{display:flex;align-items:center;justify-content:space-between;border:1px solid var(--line);padding:12px;border-radius:16px;background:#fff}
.vehicle-card,.form-card{border:1px solid var(--line);border-radius:18px;padding:14px;background:white;display:flex;justify-content:space-between;align-items:center;margin:10px 0}
.plate-head{font-size:38px;font-weight:900;letter-spacing:1px;color:#1d4ed8}
.camera-box{background:#0f172a;border-radius:22px;overflow:hidden;position:relative;min-height:270px;display:grid;place-items:center;color:white}
video,canvas,.preview-img{width:100%;display:block}
.capture-btn{position:absolute;bottom:16px;left:50%;transform:translateX(-50%);width:68px;height:68px;border-radius:50%;background:white;border:5px solid rgba(255,255,255,.55)}
.photo-thumb{width:64px;height:64px;object-fit:cover;border-radius:12px;border:1px solid var(--line)}
.photos{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.group{margin-top:16px}
.item{border:1px solid var(--line);border-radius:18px;padding:14px;background:#fff;margin:10px 0}
.item-title{font-weight:800}.criteria{font-size:13px;color:var(--muted);margin:4px 0 10px}
.pill{display:inline-flex;border-radius:999px;padding:4px 9px;background:#f1f5f9;color:#475569;font-size:12px;margin-left:6px}
.progress{height:12px;background:#e2e8f0;border-radius:999px;overflow:hidden}.progress span{display:block;height:100%;background:var(--brand);width:0}
.bottom-nav{position:fixed;bottom:0;left:0;right:0;background:rgba(255,255,255,.96);border-top:1px solid var(--line);padding:10px 14px;display:flex;gap:10px;justify-content:center}
.bottom-nav button{max-width:250px}
.hidden{display:none!important}
@media(min-width:800px){.app-shell{max-width:980px}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}}
.full-btn{width:100%}
.hero-icon{width:78px;height:78px;margin:0 auto 12px;border-radius:26px;background:linear-gradient(135deg,#2563eb,#0f766e);display:grid;place-items:center;color:#fff;font-size:38px;box-shadow:var(--shadow);animation:popIn .42s ease-out both}
.animate-in{animation:fadeUp .28s ease-out both}
.driver-mini{display:flex;flex-direction:column;gap:2px;background:#f8fafc;border:1px solid var(--line);border-radius:14px;padding:10px 12px;margin:10px 0}.driver-mini span{color:var(--muted);font-size:13px}
button.selected-ok{background:var(--ok)!important;color:#fff!important}button.selected-bad{background:var(--bad)!important;color:#fff!important}.camera-only{flex:0 0 52px!important;padding-left:0;padding-right:0;font-size:20px}.photo-wrap{position:relative;display:inline-flex}.photo-wrap button{position:absolute;right:-6px;top:-8px;width:22px;height:22px;border-radius:999px;padding:0;background:#0f172a;color:#fff;font-size:14px;line-height:22px}.photo-loading{font-size:12px;color:var(--muted);padding:8px 10px;border:1px dashed var(--line);border-radius:10px}
@keyframes fadeUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}@keyframes popIn{from{opacity:0;transform:scale(.86)}to{opacity:1;transform:scale(1)}}
.role-grid{display:grid;grid-template-columns:1fr;gap:12px;margin-top:14px}
.role-tile{display:flex;align-items:flex-start;text-align:left;gap:12px;background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px;box-shadow:0 6px 18px rgba(15,23,42,.05)}
.role-tile span{font-size:30px;width:42px;height:42px;border-radius:14px;background:#eff6ff;display:grid;place-items:center;flex:0 0 auto}
.role-tile b{display:block;font-size:17px;margin-bottom:4px}.role-tile small{display:block;color:var(--muted);font-weight:600;line-height:1.35}
.metric-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:12px}.metric-card{border:1px solid var(--line);border-radius:16px;background:#f8fafc;padding:12px}.metric-card span{display:block;color:var(--muted);font-size:12px}.metric-card b{font-size:24px;color:#0f172a}.list-row{display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:1px solid var(--line);padding:12px 0}.list-row:last-child{border-bottom:0}.list-row small{display:block;color:var(--muted);margin-top:3px}.mini-badge{font-size:12px;font-weight:800;border-radius:999px;padding:5px 9px;white-space:nowrap}.mini-badge.ok{background:#dcfce7;color:#166534}.mini-badge.bad{background:#fee2e2;color:#991b1b}.empty-state{border:1px dashed var(--line);border-radius:16px;padding:18px;text-align:center;color:var(--muted);background:#f8fafc}
@media(min-width:620px){.role-grid{grid-template-columns:1fr 1fr}.metric-grid{grid-template-columns:repeat(4,1fr)}}


/* v12 photo watermark preview modal */
.photo-thumb{cursor:pointer}
.image-modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.78);z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px;animation:fadeIn .16s ease-out}
.image-modal{width:min(960px,100%);height:min(90vh,900px);background:#fff;border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.38);display:flex;flex-direction:column;overflow:hidden}
.image-modal-head{height:54px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid #e5e7eb;color:#111827}
.image-modal-head button{width:38px;height:38px;border:0;background:#f3f4f6;border-radius:12px;font-size:24px;line-height:1;cursor:pointer}
.image-modal-body{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;background:#0f172a;overflow:auto;padding:12px}
.image-modal-body img{max-width:100%;max-height:100%;object-fit:contain;border-radius:10px}
.photo-loading{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:#475569;background:#e0f2fe;border:1px solid #bae6fd;border-radius:999px;padding:6px 10px;margin:4px}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}

/* v13 GPS required hard block */
.gps-block-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:radial-gradient(circle at top,#e0f2fe 0,#f8fafc 38%,#dbeafe 100%);
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#0f172a;
}
.gps-block-card{
  width:min(440px,100%);
  background:rgba(255,255,255,.92);
  border:1px solid rgba(148,163,184,.35);
  border-radius:24px;
  box-shadow:0 24px 80px rgba(15,23,42,.18);
  padding:28px;
  text-align:center;
  animation:gpsCardIn .32s ease-out both;
}
.gps-block-icon{font-size:56px;margin-bottom:8px;}
.gps-block-card h1{font-size:24px;margin:0 0 10px;font-weight:800;}
.gps-block-card p{line-height:1.55;margin:8px 0;}
.gps-block-card .muted{color:#64748b;font-size:14px;}
.gps-block-card button{
  margin-top:16px;
  width:100%;
  min-height:48px;
  border:0;
  border-radius:14px;
  background:#0f62fe;
  color:white;
  font-weight:700;
  font-size:16px;
}
@keyframes gpsCardIn{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}

/* v14 dashboard redirect + bottom navigation */
.has-bottom-nav{padding-bottom:108px}
.bottom-nav{
  position:fixed;
  left:50%;
  right:auto;
  bottom:12px;
  transform:translateX(-50%);
  width:min(540px,calc(100% - 22px));
  z-index:1000;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:6px;
  padding:8px;
  background:rgba(255,255,255,.94);
  border:1px solid rgba(148,163,184,.38);
  border-radius:22px;
  box-shadow:0 18px 50px rgba(15,23,42,.18);
  backdrop-filter:blur(14px);
}
.bottom-nav .nav-btn{
  max-width:none;
  min-width:0;
  padding:8px 4px;
  border-radius:16px;
  background:transparent;
  color:#475569;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  font-size:11px;
  line-height:1.1;
  box-shadow:none;
}
.bottom-nav .nav-btn span{font-size:20px;line-height:1}
.bottom-nav .nav-btn b{font-size:11px;font-weight:800;white-space:nowrap}
.bottom-nav .nav-btn.active{background:#dbeafe;color:#1d4ed8}
.bottom-nav .nav-btn:active{transform:scale(.96)}
@media(min-width:800px){.bottom-nav{width:min(720px,calc(100% - 40px))}}

/* v17 strict live camera only */
.live-camera-modal{max-width:560px;height:min(92vh,820px)}
.live-camera-body{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;padding:14px;background:#f8fafc;overflow:auto}
.live-camera-box{min-height:320px;background:#0f172a}
.live-camera-box video,.live-camera-box img{width:100%;max-height:58vh;object-fit:contain;background:#0f172a}
.live-actions{margin-top:4px}
.live-actions button{min-height:48px}
@media(max-width:560px){.live-camera-backdrop{padding:8px}.live-camera-modal{width:100%;height:96vh;border-radius:16px}.live-camera-box{min-height:280px}}


/* v20 face capture error diagnostics */
.step-debug{display:grid;gap:8px;margin:14px 0;padding:12px;border:1px solid var(--line);border-radius:16px;background:#f8fafc;font-size:13px;color:#475569}
.step-debug div{padding:8px 10px;border-radius:12px;background:#fff;border:1px solid #e2e8f0;font-weight:700}
.step-debug div.doing{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.step-debug div.ok{background:#dcfce7;border-color:#86efac;color:#166534}
.step-debug div.bad{background:#fee2e2;border-color:#fecaca;color:#991b1b}
.error-detail{margin-top:12px;border:1px solid #fecaca;background:#fff7f7;border-radius:18px;padding:14px;color:#7f1d1d}
.error-detail h3{margin:0 0 8px;font-size:18px;color:#991b1b}
.error-detail details{margin-top:10px;border:1px solid #fecaca;border-radius:14px;background:#fff;padding:10px}
.error-detail summary{cursor:pointer;font-weight:800;color:#7f1d1d}
.error-detail pre{white-space:pre-wrap;word-break:break-word;font-size:12px;line-height:1.45;color:#334155;background:#f8fafc;border-radius:12px;padding:10px;max-height:240px;overflow:auto}
.error-likely ul,.diag-list{margin:8px 0 0 18px;padding:0;line-height:1.55}
.diag-list li{margin:4px 0;color:#334155}

/* v28 user card, notifications, record detail */
.user-card{display:flex;gap:12px;align-items:center;padding:12px;border:1px solid #e4e9f2;border-radius:18px;background:#f8fbff;margin-bottom:12px}.user-card b{display:block;font-size:18px}.user-card span{display:block;color:#64748b;font-weight:700}.user-avatar{width:58px;height:58px;border-radius:18px;object-fit:cover;background:#dbeafe;border:2px solid #fff;box-shadow:0 6px 16px rgba(15,23,42,.12)}.user-avatar.placeholder{display:grid;place-items:center;font-size:30px}.list-row.clickable{cursor:pointer;border-color:#bfdbfe;background:#f8fbff}.list-row.clickable:active{transform:scale(.99)}.disabled-row{opacity:.86;background:#f8fafc}.list-row.unread{border-left:5px solid #2563eb;background:#eff6ff}.photo-grid-two{display:grid;grid-template-columns:1fr 1fr;gap:12px}.detail-photo{width:100%;max-height:260px;object-fit:contain;border:1px solid #e2e8f0;border-radius:16px;background:#fff;cursor:pointer}.detail-photo.small{width:120px;height:120px;object-fit:cover;margin:6px}.bottom-nav .nav-btn b{font-size:11px}@media(max-width:520px){.photo-grid-two{grid-template-columns:1fr}.user-avatar{width:52px;height:52px}}

/* v32 signatures */
.signature-card{background:#fff;border:1px solid #e5e7eb;border-radius:18px;padding:16px;margin:14px 0;box-shadow:0 8px 24px rgba(15,23,42,.06)}
.signature-card h2{margin:0 0 6px;font-size:20px;color:#111827}.signature-card p{margin:0 0 12px;color:#64748b;line-height:1.5}
.signature-pad{margin:12px 0}.signature-pad label{display:block;font-weight:800;margin-bottom:8px;color:#334155}.signature-pad canvas{display:block;width:100%;height:150px;background:#fff;border:2px dashed #94a3b8;border-radius:14px;touch-action:none}.sig-actions{display:flex;justify-content:flex-end;margin-top:8px}

.app-logo{width:54px;height:54px;border-radius:16px;object-fit:contain;background:#fff;box-shadow:0 8px 24px rgba(255,79,122,.22)}
