/* =========================== Face Portal — App Styles (Responsive) =========================== */
/* ---------- Design tokens ---------- */
:root {
  --bg: #0a0f1e;
  --panel: #0f172a;
  --panel-2: #0b1224;
  --text: #e8f0ff;
  --muted: #9fb1d1;
  --border: #22304a;
  --accent: #22d3ee;
  --accent-2: #2dd4bf;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 18px;
  /* Fluid scales */
  --space-1: clamp(6px, .6vw, 10px);
  --space-2: clamp(10px, 1vw, 14px);
  --space-3: clamp(14px, 1.6vw, 18px);
  --space-4: clamp(18px, 2vw, 24px);
  --fs-12: clamp(11px, .85vw, 12px);
  --fs-14: clamp(12.5px, .95vw, 14px);
  --fs-16: clamp(13.5px, 1.05vw, 16px);
  --fs-18: clamp(15px, 1.2vw, 18px);
  --fs-22: clamp(17px, 1.6vw, 22px);
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: var(--fs-16);
  background: radial-gradient(1200px 700px at 20% -10%, #0b1430 0%, var(--bg) 60%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(11, 17, 32, .85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 800;
  letter-spacing: .3px;
  font-size: var(--fs-18);
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 8px 12px;
  font-size: var(--fs-14);
}

/* ---------- Layout ---------- */
.container {
  padding: clamp(14px, 2vw, 24px);
  margin: 0 auto;
}

/* Two-column to single-column grid */
.grid.two {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(12px, 2vw, 20px);
}

@media (max-width:1100px) {
  .grid.two {
    grid-template-columns: 1fr;
  }
}

/* ---------- Panels ---------- */
.panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, .9), rgba(10, 16, 30, .9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 4px 0 14px 2px;
  font-size: var(--fs-22);
}

/* ---------- Buttons ---------- */
.btn {
  background: linear-gradient(180deg, #0e1a32, #0a162b);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .06s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  white-space: nowrap;
  touch-action: manipulation;
}

.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(34, 211, 238, .12);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, #22d3ee, #14b8a6);
  color: #062222;
  border-color: #0ea5a0;
}

.btn.outline {
  background: transparent;
}

.btn.full {
  width: 100%;
}

@media (max-width:520px) {
  .controls .btn {
    flex: 1 1 auto;
  }
}

/* ---------- Video + HUD ---------- */
.video-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0a1426;
  border: 1px solid var(--border);
}

video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  min-height: clamp(180px, 32vw, 360px);
}

.card-neo {
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, 0));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

/* small, subtle HUD */
.capture-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(6, 14, 26, .55);
  border: 1px solid rgba(255, 255, 255, .10);
  color: #dbe9ff;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(3px);
  opacity: .95;
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  gap: 12px;
  margin: 14px 0 12px;
  flex-wrap: wrap;
}

@media (pointer:coarse) {
  .controls {
    gap: 10px;
  }
}

/* ---------- Thumbnails (rectangular) ---------- */
.thumbs {
  display: flex;
  gap: clamp(10px, 2vw, 14px);
  flex-wrap: wrap;
}

.shot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.thumbs canvas {
  width: clamp(120px, 18vw, 210px);
  height: auto;
  aspect-ratio: 4 / 3;
  background: #0c1424;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

.thumbs span {
  color: var(--muted);
  font-size: var(--fs-12);
}

/* Thumbs above Result (compact version) */
.thumbs.compact {
  margin: 6px 0 12px;
  gap: clamp(8px, 2vw, 12px);
}

.thumbs.compact canvas {
  width: clamp(96px, 20vw, 160px);
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
}

/* Make thumbs a grid on narrow widths */
@media (max-width:680px) {

  .thumbs,
  .thumbs.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width:420px) {

  .thumbs,
  .thumbs.compact {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* ---------- Result card ---------- */
.result-box {
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .01));
}

.result-ok {
  border-color: rgba(34, 197, 94, .5);
  background: linear-gradient(180deg, rgba(34, 197, 94, .10), rgba(34, 197, 94, .04));
}

.result-bad {
  border-color: rgba(239, 68, 68, .6);
  background: linear-gradient(180deg, rgba(239, 68, 68, .10), rgba(239, 68, 68, .04));
}

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.badge-verified {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, .18);
  color: #b4f5c8;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid rgba(34, 197, 94, .35);
}

.badge-fail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, .18);
  color: #ffc7c7;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, .35);
}

/* Responsive photo strip (DB, Left, Right, Front) */
.result-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin: 8px 0 12px;
}

@media (max-width:720px) {
  .result-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width:420px) {
  .result-strip {
    grid-template-columns: 1fr;
  }
}

.result-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
}

.result-chip .cap {
  font-size: var(--fs-12);
  color: var(--muted);
  margin-bottom: 6px;
  white-space: nowrap;
}

.result-chip img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ---------- Details grid ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 18px;
  margin-top: 12px;
}

@media (max-width:560px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid div:nth-child(odd) {
    opacity: .85;
  }
}

/* ---------- Tables (pretty card rows) ---------- */
.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.pretty-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  padding: 6px;
}

.pretty-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0f1828;
  color: #cfe0ff;
  font-weight: 700;
  font-size: var(--fs-14);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  letter-spacing: .2px;
}

.pretty-table tbody tr {
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .015));
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

.pretty-table tbody td {
  padding: 10px 12px;
  font-size: var(--fs-14);
  border-bottom: 0;
}

.pretty-table tbody tr td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.pretty-table tbody tr td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.pretty-table tbody tr:hover {
  transform: translateY(-1px);
  transition: transform .12s ease, box-shadow .2s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
}

td img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Mobile: labeled cards */
@media (max-width:760px) {
  .pretty-table {
    border-spacing: 0;
  }

  .pretty-table thead {
    display: none;
  }

  .pretty-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 8px 0;
    padding: 10px;
    border-radius: 12px;
  }

  .pretty-table tbody td {
    display: block;
    padding: 6px 4px;
    border: 0;
  }

  .pretty-table tbody td::before {
    content: attr(data-label) ": ";
    display: block;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: .2px;
  }

  .pretty-table tbody tr td:last-child {
    grid-column: 1 / -1;
  }
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .45);
  z-index: 60;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(720px, 92vw);
  background: linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(10, 16, 30, .96));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
}

.bulk-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Generic forms ---------- */
input {
  background: #0c1424;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  width: 100%;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}

/* Alerts & sections */
.alert.error {
  color: #fecaca;
  margin: 8px 0 12px;
}

.section-title {
  margin: 18px 0 8px;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* ===== DataTable UX bits ===== */
.datatable-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pager .btn {
  padding: 6px 10px;
}

#pageLabel {
  min-width: 90px;
  text-align: center;
}

.pretty-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.pretty-table th.sort-asc::after,
.pretty-table th.sort-desc::after {
  content: "";
  border: 6px solid transparent;
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.pretty-table th.sort-asc::after {
  border-bottom-color: #8fb7ff;
  margin-top: -4px;
}

.pretty-table th.sort-desc::after {
  border-top-color: #8fb7ff;
  margin-top: 4px;
}

/* Tight small buttons in Actions column */
.btn.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn.btn-sm.danger {
  border-color: #7f1d1d;
  color: #fecaca;
}

/* SweetAlert2 dark-ish look */
.swal2-popup {
  background: #10182b !important;
  color: #e8f0ff !important;
  border: 1px solid #22304a;
  border-radius: 16px;
}

.swal2-title {
  color: #e8f0ff !important;
}

.swal2-html-container {
  color: #9fb1d1 !important;
}

.swal2-confirm {
  background: linear-gradient(180deg, #22d3ee, #14b8a6) !important;
  color: #061e1e !important;
}

.swal2-cancel {
  background: #0a162b !important;
  color: #e8f0ff !important;
  border: 1px solid #22304a !important;
}

/* (Optional legacy styles) */
#veriTable .v-photos {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

#veriTable .v-photos img,
#veriTable .v-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border, #dcdcdc);
  background: #fff;
}

#veriTable .v-photos img:hover {
  transform: scale(1.05);
  transition: transform .15s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

/* Mirror preview for selfie cams (visual only) */
video.mirrored {
  transform: scaleX(-1);
}

canvas.mirrored {
  transform: scaleX(-1);
  transform-origin: center;
}

/* minimal modal scaffolding (safe defaults) */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .35);
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #111;
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 24px;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
}

/* ===== Gate two-column layout ===== */
.gate-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: clamp(12px, 2vw, 20px);
}

@media (max-width: 980px) {
  .gate-grid {
    grid-template-columns: 1fr;
  }
}

.cam-col,
.info-col {
  display: flex;
  flex-direction: column;
}

/* ===== Oval camera overlay (no border, no animation) ===== */
.video-wrap.oval {
  position: relative;
}

.video-wrap.oval {
  --cx: 50%;
  --cy: 50%;
  --rx: 37%;
  --ry: 73%;
}

.oval-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), rgba(0, 0, 0, 0) 64%, rgba(0, 0, 0, .55) 65%);
}

/* ===== Person card (kept for reuse; not shown on this page) ===== */
.person-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .01));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  min-height: 170px;
}

.person-card .ghost {
  color: var(--muted);
  opacity: .9;
}

.person-card .card-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.person-card .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #0c1424;
}

.person-card .avatar.ghost {
  background: #0c1424;
}

.person-card .meta .name {
  font-weight: 800;
  letter-spacing: .2px;
}

.person-card .meta .sub {
  color: var(--muted);
  font-size: var(--fs-12);
}

.person-card .kvs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-top: 10px;
}

.person-card .kvs span {
  color: var(--muted);
  font-size: var(--fs-12);
  display: block;
}

.person-card .kvs b {
  word-break: break-word;
}

.person-card .granted {
  margin-top: 10px;
}

.person-card .hint {
  color: var(--muted);
  font-size: var(--fs-12);
  margin-top: 6px;
}

/* ===== Animated verify burst on video ===== */
.verify-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.verify-burst.show {
  animation: vb-fade 900ms ease forwards;
}

@keyframes vb-fade {
  0% {
    opacity: 0
  }

  10% {
    opacity: 1
  }

  70% {
    opacity: 1
  }

  100% {
    opacity: 0
  }
}

.vb-check {
  width: min(30vmin, 160px);
  aspect-ratio: 1;
  position: relative;
}

.vb-check svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.vb-circle {
  stroke: var(--success, #22c55e);
  stroke-width: 8;
  fill: rgba(34, 197, 94, .12);
  filter: drop-shadow(0 0 18px rgba(34, 197, 94, .45));
  transform-origin: center;
  animation: vb-pop 520ms cubic-bezier(.2, .9, .2, 1) both;
}

.vb-path {
  stroke: #b7ffcc;
  stroke-width: 10;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: vb-draw 420ms 120ms ease-out forwards;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45));
}

@keyframes vb-pop {
  0% {
    transform: scale(.6);
    opacity: .5
  }

  60% {
    transform: scale(1.08)
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

@keyframes vb-draw {
  to {
    stroke-dashoffset: 0
  }
}

/* expanding rings */
.vb-rings::before,
.vb-rings::after {
  content: "";
  position: absolute;
  border: 2px solid rgba(34, 197, 94, .35);
  border-radius: 50%;
  inset: calc(50% - 2px) auto auto calc(50% - 2px);
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
}

.verify-burst.show.vb-rings::before {
  animation: vb-ring 700ms 120ms ease-out forwards;
}

.verify-burst.show.vb-rings::after {
  animation: vb-ring 900ms 180ms ease-out forwards;
}

@keyframes vb-ring {
  0% {
    opacity: .55;
    transform: translate(-50%, -50%) scale(.6)
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3.2)
  }
}

/* ---- Outside-the-oval blur overlay (optional) ---- */
.video-wrap {
  position: relative;
  overflow: hidden;
}

.oval-blur {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  --cx: 50%;
  --cy: 50%;
  --rx: 42%;
  --ry: 52%;
  mask: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), transparent 98%, transparent 100%), #000;
  -webkit-mask: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), transparent 98%, transparent 100%), #000;
  mask-composite: exclude;
  -webkit-mask-composite: xor;
}

.oval-veil {
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* ===== Top navbar (alt) ===== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(11, 17, 32, .85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.topnav .nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .2px;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #0b1220;
}

.brand span {
  font-size: 15px;
}

.menu {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.menu a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
}

.menu a:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .12);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}

.pill .sep {
  opacity: .7;
}

.btn {
  background: linear-gradient(180deg, #0e1a32, #0a162b);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .06s ease, border-color .18s ease, box-shadow .18s ease;
  font-size: 14px;
}

.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(34, 211, 238, .12);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, #22d3ee, #14b8a6);
  color: #062222;
  border-color: #0ea5a0;
}

.btn.outline {
  background: transparent;
}

.btn.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* container */
main.container {
  margin: 18px auto;
  padding: 0 12px;
}

/* modal alt sizing */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .45);
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: min(720px, 92vw);
  background: linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(10, 16, 30, .96));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 24px;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
}

/* tables & forms misc (alt) */
.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.alert.error {
  color: #fecaca;
  margin: 8px 0 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, .9), rgba(10, 16, 30, .9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.panel-title {
  margin: 4px 0 14px 2px;
  font-size: clamp(18px, 1.6vw, 22px);
}

.hidden {
  display: none !important;
}

/* Blur outside oval (alt) */
.video-wrap {
  position: relative;
  overflow: hidden;
}

.video-wrap video {
  width: 100%;
  height: auto;
  display: block;
}

.oval-veil {
  --cx: 50%;
  --cy: 50%;
  --rx: 25%;
  --ry: 47%;
  position: absolute;
  inset: 0;
  pointer-events: none;
  backdrop-filter: blur(6px) brightness(0.85) contrast(0.9);
  -webkit-backdrop-filter: blur(6px) brightness(0.85) contrast(0.9);
  mask: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), transparent 98%, black 100%);
  -webkit-mask: radial-gradient(ellipse var(--rx) var(--ry) at var(--cx) var(--cy), transparent 98%, black 100%);
}

/* …compact result styles (alt) … */
body.scanning .info-col,
body.locked .info-col {
  filter: blur(1.5px) saturate(0.95);
}

.compact-card {
  margin-top: 8px;
  background: linear-gradient(180deg, #0e1b2a, #0d1520);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 16px;
}

.match-row {
  display: flex;
  align-items: end;
  gap: 10px;
}

.match-label {
  color: #9bb3c7;
  font-size: 14px;
}

.match-val {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: .5px;
}

.gate-mini {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gate-mini.hidden {
  display: none;
}

.gate-mini .tick {
  font-weight: 800;
  font-size: 20px;
  color: #23c06b;
}

.result-box {
  border-radius: 12px;
  padding: 12px;
  background: #0b1420;
}

.result-box.result-ok {
  outline: 1px solid rgba(35, 192, 107, .35);
}

.result-box.result-bad {
  outline: 1px solid rgba(210, 70, 70, .35);
}

.badge-verified,
.badge-fail {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-verified {
  background: #143b2b;
  color: #23c06b;
}

.badge-fail {
  background: #3b1414;
  color: #f17575;
}

/* Big ring animation (alt) */
.verify-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(.8);
  transition: all .25s ease;
}

.verify-burst.show {
  opacity: 1;
  transform: scale(1);
}

.vb-rings .vb-circle {
  fill: none;
  stroke: #23c06b;
  stroke-width: 6;
  opacity: .25;
  stroke-dasharray: 326;
  stroke-dashoffset: 326;
  animation: vbIn .55s ease forwards;
}

.vb-rings .vb-path {
  fill: none;
  stroke: #23c06b;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: vbTick .35s .3s ease forwards;
}

@keyframes vbIn {
  to {
    stroke-dashoffset: 0;
    opacity: .6
  }
}

@keyframes vbTick {
  to {
    stroke-dashoffset: 0
  }
}

/* ======================= RESPONSIVE ADD-ON (append only) ======================= */

/* Constrain page width on large screens */


/* Tablet down: stack columns, tighten paddings */
@media (max-width: 1024px) {
  .gate-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: clamp(12px, 2.4vw, 16px);
  }
}

/* Center the status/message card under the video */
#status {
  width: min(760px, 96%);
  margin: 12px auto 0;
}

/* Make the camera taller on mid screens for better face fill */
@media (max-width: 980px) {
  .video-wrap video {
    min-height: clamp(220px, 45vw, 420px);
  }
}

/* Very narrow phones: larger oval window and bigger touch targets */
@media (max-width: 640px) {
  .video-wrap.oval {
    --rx: 44%;
    --ry: 56%;
  }

  .controls .btn {
    flex: 1 1 45%;
  }

  .btn,
  select,
  input {
    padding: 10px 12px;
  }
}

/* Person details grid fallback (if used elsewhere) */
@media (max-width: 680px) {
  .person-card .kvs {
    grid-template-columns: 1fr;
  }
}

/* Photo strip collapse */
@media (max-width: 720px) {
  .result-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .result-strip {
    grid-template-columns: 1fr;
  }
}

/* Compact header/nav on phones */
@media (max-width: 560px) {

  .app-header,
  .topnav {
    padding: 10px 12px;
    gap: 8px;
  }

  .brand {
    font-size: 15px;
  }
}

/* Modal: safe fit on tiny screens */
@media (max-width: 480px) {
  .modal-content {
    width: 94vw;
    max-height: 86vh;
    overflow: auto;
    border-radius: 12px;
    padding: 14px;
  }
}

/* Lighten blur on small screens */
@media (max-width: 768px) {

  body.scanning .info-col,
  body.locked .info-col {
    filter: blur(1px) saturate(0.98);
  }
}

/* Extra-small devices: legibility */
@media (max-width: 360px) {
  :root {
    --space-1: 6px;
    --space-2: 8px;
    --space-3: 12px;
  }

  .panel-title {
    font-size: 17px;
  }

  .btn.btn-sm {
    padding: 6px 8px;
  }

  .capture-hud {
    font-size: 10px;
    padding: 3px 6px;
  }
}

/* ======================= Gate Live — containment + stack layout ======================= */

/* Keep everything visually inside the card */
.gate-panel.clip {
  overflow: hidden;
}

/* One-column card stack: video + status */
.cam-stack {
  display: grid;
  gap: 12px;
  width: 100%;
}

/* Video + status use panel width and are clipped to its corners */
.cam-stack>.video-wrap.centered,
.cam-stack>#status {
  width: 100%;
  margin: 0;
}

.video-wrap.in-card {
  display: block;
  border-radius: 14px;
  overflow: hidden;
}

.result-box.in-card {
  margin-top: 10px;
}

/* Better default video height */
.video-wrap.centered video {
  min-height: clamp(260px, 46vh, 560px);
  object-fit: cover;
}

/* Oval geometry adapts per breakpoint */
.video-wrap.oval {
  --cx: 50%;
  --cy: 50%;
  --rx: 37%;
  --ry: 73%;
}

@media (max-width: 1024px) {
  .video-wrap.oval {
    --rx: 44%;
    --ry: 56%;
  }
}

@media (max-width: 640px) {
  .video-wrap.oval {
    --rx: 48%;
    --ry: 48%;
  }
}

/* Safety: keep shadow/rounded corners visible */
.panel {
  position: relative;
}

.container>.panel .cam-stack {
  max-width: 100%;
}


/* ===============================
   TABS / DEVICES NAV ALIGN FIX
   =============================== */

/* container */
.tabs,
.tabbar,
.tab-bar,
.tab-nav,
.tabs-nav,
.nav-tabs,
.device-tabs,
.devices-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
  padding: 0;
}

/* remove default list styling if it’s a UL */
.nav-tabs,
.tabs-nav,
.tab-nav {
  list-style: none;
}

/* items */
.tabs a,
.tabs button,
.tabbar a,
.tabbar button,
.tab-bar a,
.tab-bar button,
.tab-nav a,
.tab-nav button,
.tabs-nav a,
.tabs-nav button,
.nav-tabs a,
.nav-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  line-height: 1;
  white-space: nowrap;
}

/* active state (works for .active or aria-current) */
.tabs .active,
.tabbar .active,
.tab-bar .active,
.tab-nav .active,
.tabs-nav .active,
.nav-tabs .active,
.tabs [aria-current="page"],
.tabbar [aria-current="page"],
.tab-bar [aria-current="page"],
.tab-nav [aria-current="page"],
.tabs-nav [aria-current="page"],
.nav-tabs [aria-current="page"] {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18) inset;
  background: rgba(255, 255, 255, .06);
}

/* small screens: force single row + horizontal scroll */
@media (max-width: 980px) {

  .tabs,
  .tabbar,
  .tab-bar,
  .tab-nav,
  .tabs-nav,
  .nav-tabs,
  .device-tabs,
  .devices-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .tabs::-webkit-scrollbar,
  .tabbar::-webkit-scrollbar,
  .tab-bar::-webkit-scrollbar,
  .tab-nav::-webkit-scrollbar,
  .tabs-nav::-webkit-scrollbar,
  .nav-tabs::-webkit-scrollbar,
  .device-tabs::-webkit-scrollbar,
  .devices-tabs::-webkit-scrollbar {
    height: 8px;
  }

  .tabs::-webkit-scrollbar-thumb,
  .tabbar::-webkit-scrollbar-thumb,
  .tab-bar::-webkit-scrollbar-thumb,
  .tab-nav::-webkit-scrollbar-thumb,
  .tabs-nav::-webkit-scrollbar-thumb,
  .nav-tabs::-webkit-scrollbar-thumb,
  .device-tabs::-webkit-scrollbar-thumb,
  .devices-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .18);
    border-radius: 999px;
  }
}