:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
.hi { display: block; font-size: .92em; opacity: .85; }
h1 .hi, h2 .hi { font-size: .8em; }
.muted { color: var(--muted); }
.center { text-align: center; }
code { background: #f3f4f6; padding: 0 4px; border-radius: 4px; word-break: break-all; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.brand img { width: 28px; height: 28px; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 14px; }
.topbar nav a { text-decoration: none; font-weight: 500; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 30px auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2.tight { gap: 10px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.row-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }

label { display: block; margin-bottom: 12px; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--text);
}
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 6px 0 0; }
input[type=file] { padding: 8px; }
label.check, label.radio, label.chip { font-weight: 400; display: inline-flex; align-items: center; }
.radio-row { display: flex; gap: 20px; margin-bottom: 12px; }
.days { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: #f9fafb; margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.hp { position: absolute; left: -9999px; }

.btn {
  display: inline-block; padding: 10px 18px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 5px 10px; font-size: .9rem; }
.btn.huge { font-size: 1.3rem; padding: 18px 32px; border-radius: 14px; }
.btn .hi { display: inline; }

.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }

.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.pill .hi { display: inline; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f9fafb; font-size: .85rem; color: var(--muted); }
tr.new td { background: #fff7ed; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); }
.stat b { display: block; font-size: 1.8rem; }
.stat span { color: var(--muted); }
.stat.alert { border-color: var(--bad); }
.stat.alert b { color: var(--bad); }

.otp-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.inline-links { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; }
.linkbtn:disabled { color: var(--muted); cursor: default; text-decoration: none; }

.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { margin: 0; }

.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.emp-card { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.emp-card img { width: 80px; height: 100px; object-fit: cover; border-radius: 8px; background: #e5e7eb; flex-shrink: 0; }
.emp-card .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: .92rem; }

.photo-pick { display: flex; gap: 14px; align-items: center; }
.photo-pick img { width: 96px; height: 128px; object-fit: cover; object-position: center 25%; border-radius: 8px; background: #e5e7eb; }

/* Public pages */
.hero { text-align: center; padding: 30px 0 24px; }
.hero h1 { font-size: 2rem; }
.hero p { max-width: 620px; margin: 0 auto 22px; color: var(--muted); }
.who { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 20px; padding-left: 20px; }
.install-card { display: flex; gap: 16px; align-items: flex-start; border-color: var(--brand); }
.install-card[hidden] { display: none; }
.install-steps { margin-top: 10px; background: #f0fdfa; border-radius: 8px; padding: 10px 12px; font-size: .92rem; }
.install-steps ol { margin: 0; padding-left: 20px; }
.install-steps .hi { margin: 6px 0 0; }
.install-icon { width: 64px; height: 64px; border-radius: 14px; flex-shrink: 0; }
.install-card h2 { font-size: 1.15rem; }
.employee-cta { text-align: center; border-color: #1e293b; }
.employee-cta .btn { background: #1e293b; }
.employee-cta .btn:hover { background: #0f172a; }
.warnbox { border-color: #f59e0b; background: #fffbeb; }

.verify { max-width: 560px; margin: 0 auto; }
.live {
  text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; margin-bottom: 10px;
  padding: 6px; border-radius: 8px; color: #fff;
  background: linear-gradient(90deg, #0f766e, #2563eb, #7c3aed, #0f766e);
  background-size: 300% 100%; animation: slide 4s linear infinite;
}
@keyframes slide { from { background-position: 0 0; } to { background-position: 300% 0; } }
.verdict { border-radius: var(--radius); padding: 18px; margin-bottom: 16px; text-align: center; border: 2px solid; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); border-color: #f59e0b; }
.verdict .big { font-size: 3rem; font-weight: 800; line-height: 1; }
.verdict h1 { font-size: 1.8rem; margin: 6px 0; }
.verdict h2 { font-size: 1.2rem; }
.verdict p { margin: 6px 0; }
.person { text-align: center; }
.person-photo { width: 210px; height: 280px; object-fit: cover; object-position: center 25%; border-radius: 12px; border: 3px solid var(--line); background: #e5e7eb; }
.match { font-size: .9rem; color: var(--muted); }
.person dl { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 8px 14px; text-align: left; margin: 14px 0 0; }
.person dd .pill { border-radius: 6px; margin-top: 4px; }
.person dt { color: var(--muted); font-size: .9rem; }
.person dt .hi { display: inline; }
.person dd { margin: 0; font-weight: 600; }
.tips ul { padding-left: 20px; margin: 0; }
.tips li { margin-bottom: 8px; }
.report summary { cursor: pointer; font-weight: 600; color: var(--bad); }
.report summary .hi { display: inline; }
.report form { margin-top: 14px; }
.scan-tips ul { padding-left: 20px; margin: 8px 0 12px; }
.scan-tips li { margin-bottom: 6px; }
.file-btn { display: block; width: 100%; }
.reader { width: 100%; max-width: 420px; margin: 16px auto; border-radius: var(--radius); overflow: hidden; background: #000; }

.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; padding: 18px 16px 28px; font-size: .9rem; }
.foot a { color: var(--muted); text-decoration: none; }

/* Employee "My ID" app */
body.myid { background: #1e293b; color: #fff; min-height: 100vh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.hi-inline { font-weight: 400; opacity: .9; }
.myid-status { margin: 10px 12px 6px; border-radius: 10px; padding: 8px 12px; text-align: center; font-size: .95rem; }
.myid-status.ok { background: #15803d; }
.myid-status.bad { background: #b91c1c; }
.myid-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; margin-top: 2px; }
.myid-status.ok .myid-clock { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.myid-offline { margin: 0 12px 6px; border-radius: 8px; padding: 6px 10px; background: #fef3c7; color: #92400e; font-size: .85rem; text-align: center; }
.myid-stage { display: flex; justify-content: center; overflow: hidden; }
.myid-stage .idcard { margin: 4px 0 0; transform-origin: top center; flex-shrink: 0; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
/* Scan history */
.hist-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 14px; }
.hist-filter .chip { cursor: pointer; font: inherit; font-size: .9rem; }
.hist-filter .chip .hi { display: inline; }
.hist-filter .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.hist-item { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--ok);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.hist-item.bad { border-left-color: var(--bad); }
.hist-photo { width: 66px; height: 88px; object-fit: cover; object-position: center 25%; border-radius: 8px; background: #e5e7eb; flex-shrink: 0; }
.hist-body { min-width: 0; flex: 1; }
.hist-top { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: .85rem; }
.hist-name { font-weight: 700; font-size: 1.05rem; margin-top: 4px; overflow-wrap: anywhere; }
.hist-role { font-size: .9rem; }
.hist-meet { font-size: .85rem; margin-top: 2px; }
.hist-item.bad .hist-meet, .hist-item .hist-meet:not(:empty) { color: var(--muted); }
.hist-link { display: inline-block; margin-top: 6px; font-size: .9rem; font-weight: 600; }
.hist-link .hi { display: inline; }
.live-qr-wrap { position: relative; width: 52mm; height: 52mm; }
/* Locked QR (Aadhaar not verified yet): a blurred, meaningless pattern with an unlock button */
.qr-fake { position: absolute; inset: 0; filter: blur(2.2mm); opacity: .55;
  background:
    repeating-linear-gradient(90deg, #000 0 2.4mm, transparent 2.4mm 4.1mm),
    repeating-linear-gradient(0deg, #000 0 1.7mm, #fff 1.7mm 3.6mm); }
.qr-unlock { position: absolute; inset: 7mm 3mm; display: flex; flex-direction: column; justify-content: center; text-align: center;
  background: #1e293b; color: #fff; border-radius: 3mm; font-size: 9pt; font-weight: 700; text-decoration: none; padding: 2mm; }
.qr-unlock span { font-weight: 400; font-size: 8pt; margin-top: 1mm; }
.myid-status.warn { background: #b45309; }
.myid-flash { margin: 10px 12px 0; }
.myid-verify .card h3 { font-size: 1rem; }
.myid-verify .card h3 .hi { font-size: .85rem; }
.myid-verify ol { padding-left: 20px; margin: 6px 0 12px; }
.myid-verify .consent { display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; margin: 6px 0 14px; }
.myid-verify .consent input { margin-top: 3px; }
.live-qr-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; font-size: 9pt; font-weight: 700; color: #92400e; background: #fef3c7; border: .5mm dashed #f59e0b; border-radius: 2mm; padding: 3mm; }
.live-qr-cover[hidden] { display: none; }
.live-qr-cover span { font-weight: 400; }
body.app-hidden .myid-stage, body.app-hidden .myid-status { filter: blur(24px); }
.live-ok { font-size: .9rem; margin-top: 8px !important; }
.idcard-invalid .idcard-photo-wrap, .idcard-invalid .idcard-info { filter: grayscale(1); opacity: .6; }
.idcard-void { width: 52mm; height: 52mm; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1mm solid #b91c1c; color: #b91c1c; font-size: 18pt; font-weight: 800; text-align: center; border-radius: 3mm; }
.idcard-void span { font-size: 13pt; }
.myid-tip { text-align: center; color: #cbd5e1; font-size: .85rem; margin: 10px 16px 0; }
.myid-install { max-width: 380px; margin: 14px auto 0; padding: 0 16px; text-align: center; color: #cbd5e1; font-size: .9rem; }
.myid-install[hidden] { display: none; }
.myid-unlink { text-align: center; margin: 14px 0 24px; }
.myid-unlink .linkbtn { color: #94a3b8; font-size: .85rem; }
.myid-login { max-width: 420px; margin: 0 auto; padding: 28px 16px; text-align: center; }
.myid-login .card { color: var(--text); text-align: left; }
.myid-login .muted { color: #cbd5e1; }
.myid-login .card .muted { color: var(--muted); }
.myid-login .inline-links a, .myid-login .inline-links .linkbtn { color: #5eead4; }
.myid-logo { width: 72px; height: 72px; border-radius: 16px; }
.btn.block { display: block; width: 100%; }
.text-bad { color: var(--bad); }
.cert-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; background: #fff; word-break: break-word; }
.cert-box form { margin-top: 8px; }
.gateway-reply { margin-top: 6px; font-size: .9rem; word-break: break-word; }
.act-code-box { background: var(--ok-bg); border: 2px dashed var(--ok); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.act-code { font-size: 2rem; font-weight: 800; letter-spacing: .15em; font-variant-numeric: tabular-nums; color: var(--ok); margin: 6px 0; }
.myid-login details { margin-top: 14px; text-align: left; }
.myid-login summary { cursor: pointer; color: #5eead4; font-weight: 600; text-align: center; }
.myid-login details .card { margin-top: 10px; }
.small { font-size: .85rem; }

/* Printable ID card: portrait, 90 x 152 mm */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.idcard {
  width: 90mm; height: 152mm; margin: 20px auto; background: #fff; border: .4mm solid #9ca3af; border-radius: 4mm;
  overflow: hidden; display: flex; flex-direction: column; align-items: center; color: #111;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.idcard-top { width: 100%; background: var(--brand); color: #fff; padding: 3mm 4mm 2.5mm; text-align: center; }
.idcard-org { font-size: 13pt; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.idcard-kind { font-size: 7pt; letter-spacing: .03em; opacity: .9; margin-top: .8mm; }
.idcard-photo-wrap { margin-top: 3mm; width: 33mm; height: 44mm; border-radius: 2.5mm; overflow: hidden; border: .5mm solid #d1d5db; background: #e5e7eb; flex-shrink: 0; }
/* Photos are cropped to 3:4 on upload; object-position keeps the face in frame for older or odd-sized photos. */
.idcard-photo { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; }
.idcard-info { text-align: center; padding: 2mm 4mm 0; width: 100%; }
.idcard-name { font-size: 15pt; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.idcard-role { font-size: 10pt; font-weight: 600; color: #374151; margin-top: .8mm; }
.idcard-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .5mm 4mm; font-size: 8pt; color: #4b5563; margin-top: 1mm; }
.idcard-qr-box { margin-top: auto; display: flex; flex-direction: column; align-items: center; }
.idcard-qr { width: 52mm; height: 52mm; display: block; image-rendering: pixelated; }
.idcard-scan { font-size: 8.5pt; font-weight: 700; margin-top: .5mm; }
.idcard-foot { width: 100%; margin-top: 2mm; background: #f3f4f6; padding: 2mm 3mm; font-size: 7.5pt; text-align: center; }
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  .no-print { display: none !important; }
  body.print-page { background: #fff; }
  .idcard { margin: 0; break-inside: avoid; }
}
