/* Passport check-in — visual system matched to the Lovable "Passport Details Scanner" */
:root {
  color-scheme: light;
  --radius: 0.5rem;
  --background: oklch(0.975 0.008 85);
  --foreground: oklch(0.22 0.04 250);
  --card: oklch(0.995 0.004 85);
  --primary: oklch(0.32 0.08 250);
  --primary-foreground: oklch(0.97 0.01 85);
  --muted: oklch(0.94 0.012 85);
  --muted-foreground: oklch(0.5 0.03 250);
  --accent: oklch(0.72 0.12 75);
  --border: oklch(0.929 0.013 255.508);
  --ring: oklch(0.704 0.04 256.788);
  --destructive: oklch(0.577 0.245 27.325);
  --ok: oklch(0.5 0.12 155);
  --ok-bg: oklch(0.95 0.04 155);
  --warn: oklch(0.5 0.1 70);
  --warn-bg: oklch(0.95 0.045 85);
  --danger-bg: oklch(0.95 0.03 27);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  box-sizing: border-box;
}

*, *::before, *::after { box-sizing: inherit; border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--background); color: var(--foreground);
  font: 400 16px/1.5 var(--font-sans);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--primary); }
p { margin: 0 0 1rem; }
h1, h2 { font-family: var(--font-display); color: var(--primary); font-weight: 700; margin: 0; }
h1 { font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; line-height: 1.2; }
@media (min-width: 768px) { h1 { font-size: 3rem; } }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.icon { width: 1rem; height: 1rem; flex: none; }
.icon-lg { width: 2rem; height: 2rem; color: var(--primary); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.wrap { max-width: 48rem; margin: 0 auto; padding: 3rem 1rem 4rem; }
@media (min-width: 768px) { .wrap { padding-top: 5rem; } }
.wrap.wide { max-width: 72rem; padding-top: 2.5rem; }
.eyebrow { font: 400 0.75rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.25em; color: var(--muted-foreground); margin: 0 0 0.75rem; }
.lede { color: var(--muted-foreground); max-width: 36rem; margin-top: 0.75rem; }
.mono { font-family: var(--font-mono); }

.card, .panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}
@media (min-width: 768px) { .card, .panel { padding: 2rem; } }
.card + .card { margin-top: 1.5rem; }
.step > .card:first-child { margin-top: 2.5rem; }

/* header bar (admin) */
.site {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--card);
}
.brand { font: 400 0.75rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.25em; color: var(--muted-foreground); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.5rem; padding: 0 1rem; border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border); background: var(--background); color: var(--foreground);
  font: 500 0.875rem/1 var(--font-sans); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--muted); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: color-mix(in oklch, var(--primary) 90%, white); }
.btn-big { height: 2.75rem; padding: 0 2rem; }
.btn-sm { height: 2.25rem; padding: 0 0.75rem; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--muted-foreground); font: inherit; font-size: 0.875rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--foreground); }

/* ---------- forms ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } .grid .full { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.field > span { font-size: 0.875rem; font-weight: 500; line-height: 1; color: var(--foreground); }
.field .opt { color: var(--muted-foreground); font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=search], textarea {
  width: 100%; height: 2.5rem; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  background: transparent; color: var(--foreground);
  font: 400 0.95rem/1.2 var(--font-mono); box-shadow: var(--shadow-sm);
}
input[type=email], input[type=tel], input[type=search], textarea { font-family: var(--font-sans); }
textarea { height: auto; min-height: 5rem; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 35%, transparent); }
input[aria-invalid=true] { border-color: var(--destructive); }
.hint { font-size: 0.8125rem; color: var(--muted-foreground); margin: 0.25rem 0 0; }
.hint.warn { color: var(--warn); font-weight: 500; }
.check { display: flex; gap: 0.625rem; align-items: flex-start; margin: 1.5rem 0 0; font-size: 0.9rem; cursor: pointer; }
.check input { width: 1rem; height: 1rem; margin: 0.2rem 0 0; accent-color: var(--primary); flex: none; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.error { color: var(--destructive); font-size: 0.875rem; margin: 1rem 0 0; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.9rem; margin: 1.5rem 0 0; }
.notice ul { margin: 0; padding-left: 1.1rem; }

/* ---------- visitor ---------- */
.drops { display: grid; gap: 1rem; }
@media (min-width: 640px) { .drops { grid-template-columns: 1fr 1fr; } }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  padding: 2rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: color-mix(in oklch, var(--muted) 50%, transparent);
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop:focus-within { border-color: var(--accent); background: var(--muted); }
.drop strong { font-weight: 600; }
.drop small { font-size: 0.875rem; color: var(--muted-foreground); }
.tips { margin: 1.25rem 0 0; font-size: 0.8125rem; color: var(--muted-foreground); }

.filerow { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 640px) { .filerow { flex-direction: row; align-items: center; } }
.filerow img { width: 10rem; height: 7rem; object-fit: cover; border-radius: calc(var(--radius) - 2px); background: var(--muted); }
.filerow .grow { flex: 1; min-width: 0; }
.filerow .grow p { margin: 0; }
.filerow .title { font-weight: 500; }
.muted { color: var(--muted-foreground); font-size: 0.875rem; }
.loading { display: flex; align-items: center; gap: 0.5rem; color: var(--muted-foreground); margin-top: 1.5rem; }
.card > h2 + .grid, .card > h2 + p + .grid { margin-top: 1.5rem; }
.card > h2 + p { margin: 0.5rem 0 0; }

.done-head { display: flex; align-items: center; gap: 0.5rem; color: var(--primary); font-weight: 500; font-size: 1.05rem; margin-bottom: 1rem; }
.done-head .icon { width: 1.25rem; height: 1.25rem; }
.ref { font-family: var(--font-mono); letter-spacing: 0.05em; }
.mrz { display: none; }

/* ---------- admin ---------- */
.admin .site nav { display: flex; align-items: center; gap: 1.25rem; margin-left: auto; flex-wrap: wrap; font-size: 0.9rem; }
.admin .site nav a { color: var(--foreground); text-decoration: none; font-weight: 500; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.admin .site nav a[aria-current=page] { border-bottom-color: var(--accent); }
.who { color: var(--muted-foreground); font-size: 0.875rem; }
.admin h1 { margin-bottom: 0.5rem; }

.login { max-width: 24rem; margin: 4rem auto; }
.login h1 { font-size: 1.875rem; }
.login form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.login .btn-big { width: 100%; }
.code-input { font-size: 1.5rem !important; letter-spacing: 0.4em; text-align: center; height: 3rem !important; }
.row-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: space-between; }

.toolbar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 1.5rem 0 1rem; }
.tabs { display: inline-flex; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); overflow: hidden; background: var(--card); }
.tabs button { border: 0; background: transparent; color: var(--foreground); font: 500 0.875rem var(--font-sans); padding: 0 0.9rem; height: 2.5rem; cursor: pointer; }
.tabs button + button { border-left: 1px solid var(--border); }
.tabs button[aria-pressed=true] { background: var(--primary); color: var(--primary-foreground); }
.count { opacity: 0.75; margin-left: 0.25rem; font-weight: 400; }
.toolbar input[type=search] { flex: 1; min-width: 14rem; max-width: 26rem; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem; white-space: nowrap; }
thead { background: var(--muted); }
th { font-weight: 600; }
tbody tr { border-top: 1px solid var(--border); cursor: pointer; }
tbody td { font-family: var(--font-mono); }
tbody tr:hover { background: color-mix(in oklch, var(--muted) 50%, transparent); }
td a { color: var(--foreground); font-weight: 500; text-decoration: none; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted-foreground); }
.pager { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1rem; }

.chip { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 99px; font: 500 0.75rem/1.4 var(--font-sans); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.pending { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--danger-bg); color: var(--destructive); }

.detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; margin-top: 1rem; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.viewer { position: sticky; top: 1rem; }
@media (max-width: 900px) { .viewer { position: static; } }
.viewer-stage {
  height: min(72vh, 640px); overflow: hidden; position: relative;
  background: var(--muted); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px);
  touch-action: none; cursor: grab;
}
.viewer-stage.dragging { cursor: grabbing; }
.viewer-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.viewer-tools { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }

.meta { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.875rem; margin: 0 0 1rem; }
.meta dt { color: var(--muted-foreground); }
.meta dd { margin: 0; }
.panel .notice { margin: 0 0 1rem; }
.scan-diff { font-size: 0.8rem; color: var(--warn); display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.scan-diff .link { font-size: 0.8rem; color: var(--warn); }
.section-title { font-size: 1.25rem; margin: 1.75rem 0 1rem; }

.verify {
  display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer;
  margin: 1.5rem 0 1rem; padding: 1rem; border-radius: var(--radius);
  border: 2px dashed var(--border); background: color-mix(in oklch, var(--muted) 50%, transparent);
}
.verify input { width: 1.25rem; height: 1.25rem; margin: 0.1rem 0 0; accent-color: var(--primary); flex: none; }
.verify strong { display: block; font-weight: 600; }
.verify small { color: var(--muted-foreground); font-size: 0.85rem; }
.verify.on { border-style: solid; border-color: var(--ok); background: var(--ok-bg); }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.activity { list-style: none; padding: 0; margin: 0; font-size: 0.875rem; }
.activity li { padding: 0.6rem 0; border-top: 1px solid var(--border); }
.activity .when { color: var(--muted-foreground); font-size: 0.8rem; display: block; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--primary); color: var(--primary-foreground);
  padding: 0.7rem 1.1rem; border-radius: var(--radius); font-weight: 500; font-size: 0.9rem; z-index: 50;
}

@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

.step > * + * { margin-top: 1.5rem; }

/* ---------- trips ---------- */
select, .select {
  width: 100%; height: 2.5rem; padding: 0 2.25rem 0 0.75rem;
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364708a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  color: var(--foreground); font: 400 0.95rem/1.2 var(--font-sans);
  box-shadow: var(--shadow-sm); appearance: none; -webkit-appearance: none; cursor: pointer;
}
select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 35%, transparent); }
select[aria-invalid=true] { border-color: var(--destructive); }
.trip-field { margin-top: 1.25rem; }
.trip-banner {
  display: inline-block; margin: 1rem 0 0; padding: 0.45rem 0.85rem;
  border-radius: var(--radius); background: var(--muted); color: var(--primary); font-size: 0.95rem;
}
.toolbar .select { width: auto; min-width: 11rem; }

.export-bar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: -0.25rem 0 1rem; }
.export-note { font-size: 0.85rem; color: var(--muted-foreground); }
.export-note a { font-weight: 500; }
.error-inline { color: var(--destructive); }

.tags { white-space: normal; min-width: 8rem; }
.tag {
  display: inline-block; margin: 0.1rem 0.25rem 0.1rem 0; padding: 0.1rem 0.5rem;
  border-radius: 99px; background: var(--muted); color: var(--primary);
  font: 500 0.75rem/1.4 var(--font-sans);
}
tbody td.tags { font-family: var(--font-sans); }
.chip { background: var(--muted); color: var(--muted-foreground); }

.trip-checks { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.check-pill {
  display: inline-flex; align-items: flex-start; gap: 0.5rem; cursor: pointer;
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  font-size: 0.9rem;
}
.check-pill input { margin: 0.2rem 0 0; accent-color: var(--primary); }
.check-pill small { display: block; color: var(--muted-foreground); font-size: 0.75rem; }
.check-pill:has(input:checked) { border-color: var(--primary); background: color-mix(in oklch, var(--muted) 60%, transparent); }

.link-code { font-family: var(--font-mono); font-size: 0.85rem; margin-right: 0.5rem; }
.row-buttons { display: flex; gap: 0.4rem; }

table.plain tbody td { font-family: var(--font-sans); }
table.plain .link-code { font-family: var(--font-mono); }

.notice-inline { margin: 0.75rem 0 0; }
.notice.notice-bad { background: var(--danger-bg); color: var(--destructive); }

/* ---------- pop-ups: one look everywhere (see /dialogs.js) ---------- */
.modal {
  width: min(28rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.5rem; border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); background: var(--card); color: var(--foreground);
  box-shadow: 0 20px 50px -12px rgb(0 0 0 / 0.3);
}
.modal::backdrop { background: rgb(15 23 42 / 0.45); }
.modal h2 { font-size: 1.35rem; margin: 0 0 0.75rem; padding-right: 1.5rem; }
.modal p { color: var(--foreground); margin: 0 0 1.25rem; }
.modal p.muted { color: var(--muted-foreground); }
.modal p.error { margin: 0 0 1rem; }
.modal .field input, .modal .field select { width: 100%; }
.modal form > .field { margin: 0 0 1.25rem; }
.modal-fields { display: grid; gap: 0.9rem; margin: 0 0 1.25rem; }
.modal-copy { width: 100%; margin: 0 0 1.25rem; font: 0.9rem/1.4 var(--font-mono); padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted); color: var(--foreground); resize: vertical; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; }
.modal-x { position: absolute; top: 0.6rem; right: 0.8rem; background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted-foreground); }
.btn-danger { color: var(--destructive); border-color: var(--destructive); }
.btn-danger:not(:disabled):hover { background: var(--destructive); color: #fff; }
@media (max-width: 480px) { .modal-actions { flex-direction: column-reverse; } .modal-actions .btn { width: 100%; } }

.trip-banner-closed { background: var(--warn-bg); color: var(--warn); }

.nowrap { white-space: nowrap; }

.trip-picker { margin-top: 0.75rem; max-width: 22rem; }

/* Admin entry mode on the public forms (/passport/?admin=1, /flights/?admin=1) */
.admin-note { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.9rem; margin: 1rem 0; }
.admin-note a { color: inherit; font-weight: 600; }
.admin-trip { margin-bottom: 1.25rem; }
.admin-trip .trip-field { margin-top: 0; }

/* "Which is your main email / phone?" (contact-check.js) */
.contact-check { max-width: 32rem; }
.cc-set { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; margin: 0 0 1rem; }
.cc-set legend { font-weight: 600; padding: 0 0.35rem; }
.contact-check .cc-why { color: var(--muted-foreground); font-size: 0.9rem; margin: 0 0 0.6rem; }
.cc-opt { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.3rem 0; cursor: pointer; overflow-wrap: anywhere; }
.cc-opt em { font-style: normal; font-size: 0.8rem; color: var(--muted-foreground); }
.cc-keep { margin-top: 0.35rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.back-main { display: inline-flex; align-items: center; gap: 0.35rem; }

/* trip page: log in to the account */
.acct-box { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 1.5rem 0 0; padding: 1rem 1.25rem; }
.acct-box p { margin: 0.2rem 0 0; font-size: 0.9rem; }
.acct-row { display: flex; gap: 0.5rem; flex: 1 1 18rem; max-width: 26rem; }
.acct-row input { flex: 1; min-width: 0; }
.acct-box .error { flex-basis: 100%; margin: 0; }

/* admin trip list: wraps instead of scrolling sideways */
.trips-table td { white-space: normal; vertical-align: top; }
.trips-table td.nowrap { white-space: nowrap; }
.trips-table .tbtns { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.trips-table td:first-child { min-width: 12rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
