/* ---------- fonts (bundled — works offline) ---------- */
@font-face { font-family: "CardBangla"; src: url("fonts/noto-serif-bengali-400.woff2") format("woff2"); font-weight: 400; }
@font-face { font-family: "CardBangla"; src: url("fonts/noto-serif-bengali-600.woff2") format("woff2"); font-weight: 600; }
@font-face { font-family: "CardBangla"; src: url("fonts/noto-serif-bengali-700.woff2") format("woff2"); font-weight: 700; }
@font-face { font-family: "TiroBangla"; src: url("fonts/tiro-bangla-400.woff2") format("woff2"); font-weight: 400; }

:root {
  --maroon: #671B42;
  --maroon-2: #9E1F63;
  --ink: #231F20;
  --red: #EF3C23;
  --ui-bg: #f5f3f4;
  --ui-card: #ffffff;
  --ui-line: #e3dde0;
  --ui-text: #2a2226;
  --ui-muted: #7a6d73;
  --side: 360px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: "Nirmala UI", "Segoe UI", "CardBangla", system-ui, sans-serif;
  font-size: 14px;
}

/* ---------- app chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: var(--maroon); color: #fff;
}
.topbar-logo { height: 40px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.topbar h1 { margin: 0; font-size: 18px; }
.topbar p { margin: 2px 0 0; font-size: 12px; opacity: .85; }
.topbar .btn { margin-left: auto; color: #fff; border-color: rgba(255,255,255,.5); }

.layout { display: grid; grid-template-columns: var(--side) 1fr; gap: 0; }
.panel {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow: auto;
  padding: 16px; border-right: 1px solid var(--ui-line); background: var(--ui-card);
}
.content { padding: 18px 22px 0; min-width: 0; }

.step { margin-bottom: 16px; }
.step h2 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.step h2 span {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--maroon); color: #fff; font-size: 12px;
}
.drop {
  display: block; position: relative; cursor: pointer;
  border: 1.5px dashed #c9b8c0; border-radius: 10px; padding: 12px 14px; background: #fcfafb;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--maroon); background: #f8f1f4; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop strong { display: block; font-size: 13px; }
.drop small { display: block; color: var(--ui-muted); margin-top: 3px; font-size: 12px; word-break: break-word; }
.drop.ok { border-style: solid; border-color: #2e8b57; background: #f1faf4; }
.drop.ok small { color: #1f6b41; }
.link-small { display: inline-block; margin-top: 5px; font-size: 12px; color: var(--maroon); cursor: pointer; text-decoration: underline; }

.field { margin: 8px 0; }
.field label { display: block; font-size: 12px; color: var(--ui-muted); margin-bottom: 3px; }
.field input[type=text], .field textarea, .field select, .table-tools input {
  width: 100%; padding: 7px 9px; border: 1px solid var(--ui-line); border-radius: 7px;
  font: inherit; background: #fff; color: inherit;
}
.field .row { display: flex; align-items: center; gap: 8px; }
.mini { width: 56px; height: 32px; object-fit: contain; border: 1px solid var(--ui-line); border-radius: 5px; background: #fff; }
.check { display: flex; gap: 6px; align-items: center; margin: 6px 0; font-size: 13px; }
.hint { font-size: 12px; color: var(--ui-muted); line-height: 1.5; }
.settings summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--ui-line);
  background: #fff; color: var(--ui-text); font: inherit; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; }
.btn.primary { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { width: 100%; padding: 11px; font-size: 15px; margin-top: 8px; }

.summary .empty { text-align: center; padding: 60px 20px; color: var(--ui-muted); }
.summary .empty img { height: 70px; opacity: .7; }
.muted { color: var(--ui-muted); font-weight: normal; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; color: var(--maroon); }
.stat span { font-size: 12px; color: var(--ui-muted); }

.issues { margin-top: 12px; background: #fff8e6; border: 1px solid #f0d58c; border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.issues ul { margin: 6px 0 0; padding-left: 18px; max-height: 150px; overflow: auto; }
.issues.err { background: #fdecec; border-color: #f2b4b4; }

.table-wrap { margin-top: 14px; background: #fff; border: 1px solid var(--ui-line); border-radius: 10px; }
.table-tools { display: flex; gap: 8px; align-items: center; padding: 10px; border-bottom: 1px solid var(--ui-line); }
.table-tools input { max-width: 280px; }
.table-scroll { max-height: 300px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #f0eaed; white-space: nowrap; }
th { position: sticky; top: 0; background: #faf6f8; font-weight: 600; z-index: 1; }
tr.off td { color: #b0a5aa; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; }
.tag.y { background: #e5f5ea; color: #1f6b41; }
.tag.n { background: #fde8e8; color: #a12828; }
.tag.g { background: #eee; color: #666; }

.preview-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 6px; }
.preview-head h2 { font-size: 16px; margin: 0; }
.zoom { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* screen preview of printable sheets */
#print-root { margin-left: var(--side); padding: 6px 22px 40px; }
#print-root .sheet {
  zoom: var(--zoom, .6);
  margin: 0 0 24px; background: #fff; box-shadow: 0 2px 14px rgba(60,20,40,.15);
}
#print-root .page-label { font-size: 12px; color: var(--ui-muted); margin: 0 0 6px; }

/* ---------- printable sheet ---------- */
.sheet { position: relative; overflow: hidden; background: #fff; }
.sheet.landscape { width: 297mm; height: 210mm; }
.sheet.portrait  { width: 210mm; height: 297mm; }
.slot { position: absolute; }
.mark { position: absolute; background: #000; }
.mark.h { height: 0.15mm; width: 4mm; }
.mark.v { width: 0.15mm; height: 4mm; }
.sheet-note { position: absolute; left: 8mm; bottom: 4mm; font: 7pt/1 "Segoe UI", sans-serif; color: #999; }

/* ---------- ID card (54.7 x 85.4 mm, as in the supplied format) ---------- */
.card {
  position: absolute; width: 54.7mm; height: 85.4mm; overflow: hidden;
  background: #fff; border: 0.35mm solid #1d1d1b;
  font-family: "CardBangla", "Nirmala UI", serif; color: var(--ink);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.card * { position: absolute; margin: 0; }
.card .one { white-space: nowrap; }

.card .title {
  left: 1mm; right: 1mm; text-align: center; line-height: 1;
  font-size: 14pt; font-weight: 400; letter-spacing: -0.1pt;
}
.card .title small { position: static; font-size: 9.6pt; }

/* front */
.card .logo { top: 2.2mm; left: 50%; width: 20.5mm; transform: translateX(-50%); }
.card.front .title { top: 14.3mm; }
.card .photo {
  top: 21.2mm; left: 17.1mm; width: 20.5mm; height: 28.2mm;
  border: 0.4mm solid #111; border-radius: 1mm; overflow: hidden; background: #e9e4e6;
}
.card .photo img { position: static; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; }
.card .photo .ph { position: static; display: grid; place-items: center; height: 100%; font-size: 6pt; color: #999; }

.card .enroll { top: 49.9mm; left: 0; right: 0; font-size: 8.2pt; font-weight: 700; color: var(--maroon-2); }
.card .enroll .l { right: 27.2mm; text-align: right; }
.card .enroll .c { left: 28mm; }
.card .enroll .v { left: 29.4mm; }

.card .f-row { left: 0; right: 0; height: 3.5mm; font-size: 7.4pt; line-height: 1; }
.card .f-row .l { left: 12.3mm; top: .35mm; font-weight: 400; }
.card .f-row .c { left: 28mm; top: .35mm; }
/* note: no overflow:hidden on value spans — it breaks Bangla shaping of bold text in Chrome */
.card .f-row .v { left: 29.4mm; right: 1.2mm; font-size: 8.4pt; font-weight: 600; }
.card .f-row.name .v { font-size: 9.6pt; font-weight: 700; top: -.35mm; }

.card .band {
  left: 0; right: 0; bottom: 0; height: 9.3mm; background: var(--maroon); color: #fff;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-weight: 700; font-size: 7.6pt; line-height: 1;
}
.card .band .q1 { top: 1.1mm; left: 0; right: 4mm; text-align: center; }
.card .band .q2 { top: 4.9mm; right: 4.6mm; }

/* back */
.card.back .title { top: 3.9mm; }
.card .wm { top: 9.5mm; left: 50%; width: 50mm; transform: translateX(-50%); opacity: .14; }
.card .b-row { left: 0; right: 0; height: 4.2mm; font-size: 8.2pt; line-height: 1; }
.card .b-row .l { left: 7.6mm; top: .3mm; }
.card .b-row .c { left: 21.6mm; top: .3mm; }
.card .b-row .v { left: 23mm; right: 1.2mm; font-weight: 600; font-size: 8.6pt; }

.card .pill {
  top: 43.6mm; left: 50%; transform: translateX(-50%);
  height: 6.2mm; padding: 0 2.6mm; border-radius: 3.1mm; background: var(--maroon); color: #fff;
  font-size: 11pt; line-height: 6.2mm; white-space: nowrap; font-weight: 600;
}
.card .ret { top: 51.2mm; left: 1mm; right: 1mm; text-align: center; color: var(--red); font-size: 6.7pt; line-height: 3.05mm; font-weight: 600; }
.card .ret div { position: static; white-space: nowrap; }
.card .ret .web { font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: 7pt; }

.card .sig { object-fit: contain; object-position: center bottom; }
.card .sig.emp { top: 69.6mm; left: 3.2mm; width: 13.4mm; height: 8.2mm; }
.card .sig.auth { top: 69.4mm; left: 36.4mm; width: 14.6mm; height: 8.4mm; }
.card .sig-line { top: 78.1mm; height: 0; border-top: 0.3mm solid #111; }
.card .sig-line.emp { left: 3mm; width: 13.6mm; }
.card .sig-line.auth { left: 35.4mm; width: 15.8mm; }
.card .sig-lbl { top: 78.8mm; font-size: 6.4pt; font-weight: 600; white-space: nowrap; transform: translateX(-50%); }
.card .sig-lbl.emp { left: 9.8mm; }
.card .sig-lbl.auth { left: 43.3mm; }
.card .sig-missing { top: 74mm; left: 3.2mm; width: 13.4mm; text-align: center; font-size: 5pt; color: #c33; }
.card .band-thin { left: 0; right: 0; bottom: 0; height: 2.5mm; background: var(--maroon); }

/* ---------- print ---------- */
@media print {
  html, body { background: #fff; }
  .no-print { display: none !important; }
  #print-root { margin: 0; padding: 0; }
  #print-root .page-label { display: none; }
  #print-root .sheet { zoom: 1; margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  #print-root .sheet:last-child { break-after: auto; page-break-after: auto; }
}
