/* ODAS PoC — shared styles (field app + central console). Identity from the ODAS document. */
:root {
  --navy: #1b4379;
  --navy2: #122e52;
  --sky: #23a5de;
  --teal: #0aafa5;
  --teal-ink: #066f68;
  --lime: #b8d313;
  --ink: #15202b;
  --muted: #586675;
  --pale: #eef8f8;
  --line: #cde8e7;
  --bg: #eaf3f4;
  --card: #fff;
  --ok: #3f6b00;
  --ok-bg: #e6f5d1;
  --warn: #7a5a00;
  --warn-bg: #fff4cc;
  --bad: #9c2f2f;
  --bad-bg: #fde2e2;
  --info: #08756e;
  --info-bg: #dff6f3;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(27, 67, 121, 0.1);
  --font: Cairo, 'Segoe UI', Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
h1, h2, h3 { color: var(--navy2); line-height: 1.3; margin: 0 0 8px; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden, [hidden] { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 11px 18px;
  font-weight: 700; cursor: pointer; background: linear-gradient(135deg, var(--navy2), var(--teal)); color: #fff; min-height: 46px;
  text-decoration: none; transition: transform 0.08s, opacity 0.2s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 1.1rem; }
.btn.sec { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px dashed var(--line); }
.btn.ok { background: #4c7d06; }
.btn.bad { background: #b23a3a; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 0.88rem; border-radius: 9px; }
.iconbtn { border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-weight: 700; min-height: 36px; }

/* ------------------------------------------------------------------ forms */
label { display: block; font-weight: 600; color: var(--navy2); margin-bottom: 4px; font-size: 0.92rem; }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], input[type='time'], input[type='search'],
input[type='email'], input[type='tel'], input[type='url'], input[type='datetime-local'], input[type='month'],
input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; min-height: 44px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(35, 165, 222, 0.45); outline-offset: 1px; border-color: var(--sky); }
.field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: 20px; height: 20px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h3 { margin-bottom: 4px; }
.box { border: 1px solid var(--line); border-inline-start: 5px solid var(--teal); background: linear-gradient(180deg, #fff, var(--pale)); border-radius: 10px; padding: 10px 14px; }
.box.warn { border-inline-start-color: #d9a400; background: #fffaf0; }
.box.bad { border-inline-start-color: #c44; background: #fff6f6; }

/* ----------------------------------------------------------------- status */
.status { display: inline-block; border-radius: 20px; padding: 1px 10px; font-size: 0.8rem; font-weight: 800; white-space: nowrap; }
.status.pending { background: var(--warn-bg); color: var(--warn); }
.status.synced { background: var(--info-bg); color: var(--info); }
.status.verified { background: var(--ok-bg); color: var(--ok); }
.status.rejected { background: var(--bad-bg); color: var(--bad); }
.status.absent { background: #eceff3; color: #3d4852; }
.status.notyet { background: #f1f4f7; color: var(--muted); }
.flag { display: inline-block; background: #f3f6f9; border: 1px solid #dbe3ea; color: #3d4852; border-radius: 8px; padding: 0 8px; font-size: 0.78rem; margin: 2px 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 2px 10px; font-size: 0.8rem; font-weight: 700; background: rgba(255, 255, 255, 0.15); color: #fff; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa5b1; }
.chip.on .dot { background: #7ee07e; }
.chip.off .dot { background: #ff8a80; }
.chip.warn .dot { background: #ffd54f; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: var(--pale); color: var(--teal-ink); border: 1px solid var(--line); }

/* ------------------------------------------------------------- field app */
body.app { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; background: linear-gradient(135deg, var(--navy2), var(--navy) 60%, var(--teal-ink)); color: #fff;
  padding: calc(8px + env(safe-area-inset-top)) 14px 10px; box-shadow: 0 4px 16px rgba(18, 46, 82, 0.25); }
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.topbar .brand b { font-size: 1.05rem; display: block; line-height: 1.1; }
.topbar .brand span { font-size: 0.75rem; opacity: 0.85; }
.topbar .indicators { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
main.view { max-width: 720px; margin: 0 auto; padding: 14px; }
.tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgba(18, 46, 82, 0.08); }
.tabbar button { flex: 1; border: 0; background: none; padding: 8px 4px 10px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: 0.82rem; }
.tabbar button .ic { display: block; font-size: 1.3rem; line-height: 1.2; }
.tabbar button.active { color: var(--navy); box-shadow: inset 0 3px 0 var(--teal); }
.tabbar .badge { background: #d9a400; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 0.7rem; margin-inline-start: 3px; }

.login { max-width: 420px; margin: 6vh auto 0; }
.login .logo { width: 108px; height: 108px; border-radius: 26px; display: block; margin: 0 auto 10px; box-shadow: var(--shadow); }
.demo-list { font-size: 0.85rem; }
.demo-list button { border: 1px solid var(--line); background: var(--pale); border-radius: 8px; padding: 4px 10px; margin: 3px; cursor: pointer; font-weight: 700; color: var(--navy); }

.session { position: relative; overflow: hidden; }
.session::before { content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--teal), var(--lime)); }
.session .meta { font-size: 0.86rem; color: var(--muted); }
.session .state { font-size: 0.75rem; font-weight: 800; border-radius: 6px; padding: 1px 8px; }
.state.open { background: var(--ok-bg); color: var(--ok); }
.state.upcoming { background: var(--warn-bg); color: var(--warn); }
.state.closed, .state.cancelled { background: #eceff3; color: #4a5561; }

/* check-in */
.stage { position: relative; background: #0d1b2a; border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 52vh; width: 100%; margin: 0 auto; }
.stage video, .stage canvas.overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage.mirror video, .stage.mirror canvas.overlay { transform: scaleX(-1); }
.stage .guide { position: absolute; inset: 12% 18%; border: 3px dashed rgba(255, 255, 255, 0.55); border-radius: 50% / 42%; pointer-events: none; transition: border-color 0.2s; }
.stage.good .guide { border-color: #7ee07e; border-style: solid; }
.stage .hud { position: absolute; inset-inline: 10px; bottom: 10px; background: rgba(13, 27, 42, 0.72); color: #fff; border-radius: 12px; padding: 8px 12px; font-weight: 700; text-align: center; }
.stage .camtools { position: absolute; top: 10px; inset-inline-end: 10px; display: flex; gap: 6px; }
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.stepbox { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.stepbox .k { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.stepbox .v { font-weight: 800; color: var(--navy2); }
.stepbox.ok { border-color: #9fd67a; background: #f6fcef; }
.stepbox.warn { border-color: #f0d27a; background: #fffbef; }
.stepbox.bad { border-color: #f0a3a3; background: #fff5f5; }
.result { text-align: center; padding: 24px 16px; }
.result .big { font-size: 3.4rem; line-height: 1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.9rem; text-align: start; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.person-row { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--pale); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; border: 1px solid var(--line); }
.photo { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; background: #e8eef3; display: block; }
.photo.noimg { background: repeating-linear-gradient(45deg, #eef2f5, #eef2f5 8px, #e4eaef 8px, #e4eaef 16px); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

#toasts { position: fixed; z-index: 100; top: 12px; inset-inline: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: var(--navy2); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; max-width: 520px; transition: opacity 0.4s, transform 0.4s; }
.toast.ok { background: #3f6b00; }
.toast.bad { background: #9c2f2f; }
.toast.out { opacity: 0; transform: translateY(-8px); }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(27, 67, 121, 0.2); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ console */
body.admin { background: #eef4f6; }
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--navy2), var(--navy)); color: #fff; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .brand { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.side .brand img { width: 40px; height: 40px; border-radius: 10px; }
.side nav button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; color: #dbe7f3; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; text-align: start; }
.side nav button.active, .side nav button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.side nav .count { margin-inline-start: auto; background: var(--lime); color: var(--navy2); border-radius: 10px; padding: 0 7px; font-size: 0.75rem; }
.side .foot { margin-top: 16px; font-size: 0.8rem; opacity: 0.85; }
.content { padding: 20px 24px; min-width: 0; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi .n { font-size: 1.7rem; font-weight: 900; color: var(--navy2); line-height: 1.1; }
.kpi .l { font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.kpi.accent { border-top: 4px solid var(--teal); }
.kpi.warnk { border-top: 4px solid #d9a400; }
.kpi.badk { border-top: 4px solid #c44; }
table.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; font-size: 0.9rem; }
.tbl th { background: linear-gradient(135deg, var(--navy2), var(--navy)); color: #fff; padding: 9px 10px; text-align: start; font-weight: 700; white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #e4eeee; vertical-align: middle; }
.tbl tr:nth-child(even) td { background: #f7fbfb; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #eef8f8; }
.tablewrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.thumb { width: 44px; height: 56px; object-fit: cover; border-radius: 6px; background: #e8eef3; display: block; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters .field { margin: 0; min-width: 140px; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); font-weight: 700; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: middle; }
.review-card { display: grid; grid-template-columns: 150px 150px 1fr; gap: 12px; align-items: start; }
.mapbox { height: 300px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(13, 27, 42, 0.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 680px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { margin: 0; }
.modal .body { padding: 16px 18px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.xbtn { border: 0; background: var(--pale); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1.1rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side nav button { width: auto; }
  .content { padding: 14px; }
  .review-card { grid-template-columns: 1fr 1fr; }
  .review-card > .info { grid-column: 1 / -1; }
}
@media print {
  .side, .pagehead .btn, .filters, #toasts, .noprint { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card, .kpi, .tablewrap { box-shadow: none; break-inside: avoid; }
}

/* ------------------------------------------------------ field app v2 (wizard) */
.langsel { width: auto; min-height: 36px; padding: 4px 8px; border-radius: 9px; font-weight: 700; border: 1.5px solid var(--line); background: #fff; }
.wsteps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 10px 0 14px; }
.wsteps li { flex: 1; text-align: center; font-size: 0.7rem; color: var(--muted); font-weight: 700; min-width: 0; }
.wsteps li span { display: flex; width: 28px; height: 28px; margin: 0 auto 2px; border-radius: 50%; align-items: center; justify-content: center; background: #dfe8ec; color: var(--muted); font-weight: 800; }
.wsteps li em { font-style: normal; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsteps li.on span { background: var(--navy); color: #fff; box-shadow: 0 0 0 3px rgba(10, 175, 165, 0.35); }
.wsteps li.on { color: var(--navy2); }
.wsteps li.done span { background: var(--teal); color: #fff; }
.wbody { min-height: 40vh; }
.wnav { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 5; }
.list li.click { cursor: pointer; }
.list li.sel { border-color: var(--teal); background: var(--pale); }
.okcard { border-color: #9fd67a; background: #f6fcef; text-align: center; }
.warncard { border-color: #f0d27a; background: #fffbef; text-align: center; }
.card .big { font-size: 2.6rem; line-height: 1.1; }
.stage.wide { aspect-ratio: 4 / 3; }
.shutterbar { display: flex; justify-content: center; margin: -38px 0 8px; position: relative; z-index: 3; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: var(--teal); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.shutter span { width: 52px; height: 52px; border-radius: 50%; background: #fff; opacity: 0.9; }
.shutter:disabled { background: #9aa5b1; cursor: not-allowed; }
.shutter:not(:disabled):active { transform: scale(0.95); }
.facecard { position: relative; }
.facethumb { width: 150px; height: 188px; object-fit: cover; border-radius: 14px; display: block; margin: 0 auto 10px; border: 5px solid #c8d3dc; }
.envthumb { width: 100%; max-height: 50vh; object-fit: cover; border-radius: 12px; }
.facecard .ring { position: absolute; top: 14px; inset-inline-end: 14px; width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; color: #fff; background: #8a97a3; font-size: 1.05rem; }
.lvl-green .facethumb { border-color: #2e8b3a; } .lvl-green .ring { background: #2e8b3a; } .lvl-green { background: #f3fbf1; border-color: #9fd67a; }
.lvl-amber .facethumb { border-color: #d99a00; } .lvl-amber .ring { background: #d99a00; } .lvl-amber { background: #fffaee; border-color: #f0d27a; }
.lvl-red .facethumb { border-color: #c43b3b; } .lvl-red .ring { background: #c43b3b; } .lvl-red { background: #fff5f5; border-color: #f0a3a3; }
.meterbar { height: 10px; border-radius: 6px; background: #e3eaef; overflow: hidden; max-width: 260px; margin: 6px auto; }
.meterbar span { display: block; height: 100%; background: currentColor; }
.lvl-green .meterbar { color: #2e8b3a; } .lvl-amber .meterbar { color: #d99a00; } .lvl-red .meterbar { color: #c43b3b; }
.lvlpill { display: inline-block; border-radius: 20px; padding: 1px 10px; font-weight: 800; font-size: 0.8rem; }
.lvlpill.green { background: #e3f4e5; color: #1f6a2a; } .lvlpill.amber { background: #fff3d1; color: #7a5a00; } .lvlpill.red { background: #fde2e2; color: #9c2f2f; }
.samples { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.samples img { width: 70px; height: 88px; object-fit: cover; border-radius: 8px; border: 2px solid var(--line); }
.chip.warn .dot { background: #ffd54f; }
.demo-list { margin-top: 10px; }
