:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1c2330; --muted: #5d6677; --line: #d9dde4;
  --accent: #1d4ed8; --good: #15803d; --warn: #b45309; --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
main { max-width: 560px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1040px; }
h1 { font-size: 1.35rem; margin: 8px 0 4px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.muted { color: var(--muted); font-size: .9rem; }
ul.plain { padding-left: 20px; margin: 8px 0; }
button, .btn {
  display: inline-block; font: inherit; font-weight: 600; padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; min-height: 44px;
}
button.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row > * { flex: 1 1 140px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0; }
.check input { width: auto; margin-top: 5px; }
.msg { padding: 10px 12px; border-radius: 8px; margin: 12px 0; background: #fef3c7; color: #78350f; }
.msg.bad { background: #fee2e2; color: #7f1d1d; }
.msg.good { background: #dcfce7; color: #14532d; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: #e5e7eb; color: #374151; }
.badge.verified, .badge.completed { background: #dcfce7; color: #14532d; }
.badge.fallback_required { background: #fef3c7; color: #78350f; }
.badge.cancelled, .badge.expired { background: #fee2e2; color: #7f1d1d; }
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid { grid-template-columns: 380px 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.pick { cursor: pointer; }
tr.pick:hover, tr.sel { background: #eef2ff; }
.qr svg { width: 100%; max-width: 280px; height: auto; display: block; margin: 8px auto; }
.photo { width: 120px; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
code { background: #eef0f4; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
dl { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin: 8px 0; }
dt { color: var(--muted); }
dd { margin: 0; }
.hidden { display: none; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 8px 0 16px; }
.tab { background: none; color: var(--muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 14px; min-height: 44px; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
td select { width: auto; min-width: 120px; }

@media print { .noprint { display: none !important; } body { background: #fff; } .card { border: 0; padding: 0; } }
details.more { margin: 12px 0; }
details.more > summary { cursor: pointer; padding: 12px 4px; font-weight: 600; color: var(--muted, #555); min-height: 44px; }

.good-sign { color: #0a7d3b; }
.loader { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-weight: 600; }
.loader .spin { width: 22px; height: 22px; border: 3px solid #cbd5e1; border-top-color: #1d4ed8; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-weight: 600; margin: 8px 0; }
.st-ok { background: #dcfce7; color: #14532d; }
.st-bad, .st-wait { background: #fee2e2; color: #7f1d1d; }

/* live camera: full screen, with the Take button fixed at the bottom */
body.cam-open { overflow: hidden; }
.camlayer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box; padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); background: #0b1220; color: #e2e8f0; }
.camlayer video { flex: 1 1 auto; min-height: 0; width: 100%; margin: 0 !important; object-fit: contain; background: #000; border-radius: 8px; }
.camlayer .muted { color: #cbd5e1; margin: 0; }
.camlayer table, .camlayer dl { color: #e2e8f0; }
/* only the box that shows what was read is capped; the step bar, the bar and the picture are not */
.camlayer > div:not(.cambar):not(.status):not(.camsteps):not(.camvideo):not(.camprog) { max-height: 30vh; overflow: auto; }
.cambar { display: flex; flex-direction: column; gap: 8px; }
.cambar > button { width: 100%; padding: 16px; font-size: 1.1rem; }
.cambar .row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.cambar .row > button { flex: 1 1 140px; padding: 10px 12px; font-size: .9rem; }
.camsteps { display: flex; gap: 8px; }
.campill { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: #1e293b; color: #94a3b8; font-weight: 700; }
.campill.active { background: #1d4ed8; color: #fff; }
.campill.done { background: #166534; color: #fff; }
.campill canvas { height: 28px; width: auto; border-radius: 4px; border: 1px solid #fff; }
.camguide { margin: 0; font-weight: 700; font-size: 1.05rem; color: #fff; }
.camlayer video.shot { animation: shot .4s ease-out; }
@keyframes shot { 0% { filter: brightness(4); } 100% { filter: none; } }
/* keep the small parts at their full size: only the camera picture gives way on a short screen */
.camlayer { height: 100dvh; bottom: auto; }
.camlayer > * { flex: none; }
.camlayer > video { flex: 1 1 0; min-height: 120px; }
.camlayer > div:not(.cambar):not(.status):not(.camsteps):not(.camvideo):not(.camprog) { max-height: 24vh; }
.camlayer .camdiag { display: none; }
.cambar .row { flex-wrap: nowrap; }
.cambar .row > button { flex: 1 1 0; min-width: 0; padding: 8px 6px; font-size: .8rem; line-height: 1.2; }
.camlayer td { padding: 1px 8px 1px 0 !important; border: 0 !important; font-size: .85rem; }
.camclose { flex: none; width: 44px; min-height: 40px; padding: 0; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: #1e293b; color: #e2e8f0; border: 0; }
.campill { cursor: default; }
.campill.done { cursor: pointer; }
.camhint { margin: 0; font-size: .9rem; color: #cbd5e1; }
.camprog { height: 6px; border-radius: 999px; background: #1e293b; overflow: hidden; }
.camprog.off, .camframe.off { display: none; }
.camprog-fill { height: 100%; width: 0; background: #22c55e; border-radius: 999px; transition: width .45s linear; }
.camprog.search .camprog-fill { width: 35%; background: #60a5fa; animation: camslide 1.2s ease-in-out infinite; }
@keyframes camslide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.camvideo { position: relative; display: flex; flex: 1 1 0; min-height: 120px; }
.camvideo video { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; object-fit: contain; background: #000; border-radius: 8px; margin: 0 !important; }
.camframe { position: absolute; inset: 7% 5%; border: 3px dashed rgba(255,255,255,.8); border-radius: 14px; pointer-events: none; transition: border-color .25s; }
.camframe.search { animation: campulse 1.6s ease-in-out infinite; }
@keyframes campulse { 50% { border-color: rgba(255,255,255,.3); } }
.camframe.hold, .camframe.taking { border-style: solid; border-color: #22c55e; }
/* kept pictures on the check-in screen, enlarged on click, and the one-page print */
.pics { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.pic-thumb { flex: 1 1 140px; max-width: 280px; min-width: 0; border-radius: 8px; border: 1px solid #cbd5e1; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .9); display: flex; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #fff; }
.lightbox-x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; padding: 0; border-radius: 999px; font-size: 1.6rem; line-height: 1; background: #1e293b; color: #fff; border: 0; }
.sheet { max-width: 190mm; margin: 0 auto; }
.sheet-dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 8px 0; }
.sheet-dl dt { color: #475569; }
.sheet-dl dd { margin: 0; font-weight: 600; }
.sheet-pics { display: flex; flex-direction: column; gap: 8mm; margin: 6mm 0; }
.sheet-pics img { display: block; max-width: 100%; max-height: 110mm; margin: 0 auto; object-fit: contain; border: 1px solid #94a3b8; }
.sheet-foot { font-size: .85rem; }
@media print { @page { size: A4; margin: 12mm; } .sheet-pics img { max-height: 112mm; } }
.pic-thumb.single { flex: 0 1 460px; max-width: 460px; }
.sheet-pics.one img { max-height: 225mm; }
@media print { .sheet-pics.one img { max-height: 228mm; } }
.lightbox img { cursor: zoom-in; }
.lightbox-hint { position: fixed; left: 0; right: 0; bottom: 8px; text-align: center; color: #cbd5e1; font-size: .85rem; pointer-events: none; }
.lightbox-x { position: fixed; }
.lightbox.zoomed { display: block; overflow: auto; cursor: default; padding: 0; }
.lightbox.zoomed img { max-width: none; max-height: none; width: auto; height: auto; border-radius: 0; cursor: zoom-out; }
.sheet-pics img { cursor: zoom-in; }
/* on screen only: full size, scroll to move around. Printing ignores this and always fits the page. */
@media screen { .sheet:has(.sheet-pics.zoomed) { max-width: 100%; } .sheet-pics.zoomed { align-items: flex-start; } .sheet-pics.zoomed img { max-width: none; max-height: none; width: auto; flex: none; margin: 0; cursor: zoom-out; } }
.lightbox-bar { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: rgba(15, 23, 42, .92); padding: 6px 10px; border-radius: 999px; z-index: 2; }
.lightbox-btn { min-width: 44px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 0; background: #1d4ed8; color: #fff; font-size: 1.1rem; font-weight: 700; }
.lightbox-level { color: #e2e8f0; min-width: 3.5em; text-align: center; font-weight: 600; }
.lightbox-hint { display: none; }
/* zoomed: the picture sits in a box of its own with scroll bars that are always in view (not at the end of a very tall page) */
@media screen { .sheet-pics.zoomed { display: block; overflow: auto; max-height: 76vh; border: 1px solid #94a3b8; border-radius: 6px; cursor: grab; background: #e2e8f0; } .sheet-pics.zoomed img { border: 0; user-select: none; -webkit-user-drag: none; } }
.lightbox.zoomed { cursor: grab; }
.lightbox.zoomed img { user-select: none; -webkit-user-drag: none; }
/* Printing: a page picture (an e-Aadhaar letter) uses almost the whole A4 sheet (about 93% of its real size) so its small print stays
   readable on paper; the header and footer shrink to a line or two instead of taking a quarter of the page. */
@media print {
  @page { size: A4; margin: 6mm; }
  .sheet { max-width: none; }
  .sheet h1 { font-size: 11pt; margin: 0; }
  .sheet > p.muted:not(.sheet-foot) { display: none; }
  .sheet-dl { display: block; margin: 1mm 0 2mm; font-size: 8.5pt; }
  .sheet-dl dt, .sheet-dl dd { display: inline; margin: 0 2mm 0 0; }
  .sheet-dl dd { margin-right: 5mm; }
  .sheet-pics { margin: 0; gap: 4mm; }
  .sheet-pics.one img { width: 198mm; max-width: 198mm; max-height: 258mm; border: 0; }
  .sheet-foot { font-size: 7.5pt; margin: 1mm 0 0; }
}
/* On screen the page picture uses the width of the window (the app's 560 px column made a whole A4 page about 500 px wide: unreadable);
   on paper it uses the whole sheet (the column limit and its padding are removed for printing). */
@media screen { .sheet { max-width: 1000px; } .sheet-pics.one img { max-height: none; } }
@media print { html, body { margin: 0; padding: 0; background: #fff; } main, main.wide { max-width: none; margin: 0; padding: 0; } }
/* the large "turn your Aadhaar over" message that covers the picture for a few seconds after a picture is taken */
.camturn { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; color: #fff; background: rgba(15, 23, 42, .78); border-radius: 8px; pointer-events: none; }
.camturn.hidden { display: none; }
.camturn svg { width: 92px; height: 92px; color: #fbbf24; animation: camflip 1.6s ease-in-out infinite; }
@keyframes camflip { 50% { transform: rotateY(180deg); } }
.camturn-big { font-size: 1.7rem; font-weight: 800; line-height: 1.2; }
.camturn-sub { font-size: 1.1rem; color: #e2e8f0; }
.badge.out { background: #e2e8f0; color: #334155; }
.hotelhead { display: flex; align-items: center; gap: 12px; }
.hotellogo { max-height: 48px; max-width: 120px; object-fit: contain; border-radius: 6px; }
