.student-id-card-launch {
  border: 0;
  cursor: pointer;
}
.student-id-card-launch svg {
  width: 21px;
  height: 21px;
}
.student-id-card-launch-header {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ecfdf5;
  color: #059669;
  box-shadow: 0 1px 3px #0f172a14;
}
.student-id-card-launch-sidebar {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f0fdf4;
  color: #059669;
  font-size: 14px;
  font-weight: 800;
}
.student-id-card-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: #020617b8;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.student-id-card-dialog {
  width: min(900px, 100%);
  background: #f8fafc;
  border-radius: 28px;
  box-shadow: 0 30px 100px #02061766;
  overflow: hidden;
}
.student-id-card-dialog > header {
  height: auto;
  position: static;
  padding: 18px 22px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.student-id-card-dialog > header small {
  display: block;
  color: #059669;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}
.student-id-card-dialog > header h2 {
  margin: 3px 0 0;
  font-size: 21px;
  color: #0f172a;
}
.student-id-card-dialog > header button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 24px;
  cursor: pointer;
}
.student-id-card-dialog > main {
  padding: 22px;
}
.student-id-card-loading,
.student-id-card-error {
  text-align: center;
  padding: 60px 20px;
  font-weight: 800;
  color: #64748b;
}
.student-id-card-error {
  color: #dc2626;
}
.student-id-card-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.student-id-card {
  position: relative;
  aspect-ratio: 1.586/1;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 45px #0f172a24;
  font-family: Inter, system-ui, sans-serif;
}
.student-id-card-front,
.student-id-card-back {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}
.student-id-card > canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.student-id-card-back:before {
  display: none;
}
.student-id-card-front {
  background: linear-gradient(145deg, #fff 0 68%, #ecfdf5 68%);
  border: 1px solid #d1fae5;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.student-id-card-topline {
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, #059669, #14b8a6, #0f766e);
}
.student-id-card-brand {
  height: auto;
  position: static;
  border: 0;
  background: transparent;
  padding: 0;
  display: grid;
  grid-template-columns: 48px 1fr 42px;
  gap: 10px;
  align-items: center;
}
.student-id-card-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.student-id-card-brand img:last-child {
  width: 38px;
  height: 38px;
}
.student-id-card-brand small {
  color: #059669;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.11em;
}
.student-id-card-brand h3 {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.15;
  color: #0f172a;
  text-transform: uppercase;
}
.student-id-card-brand p {
  margin: 2px 0 0;
  font-size: 8px;
  color: #64748b;
  font-weight: 700;
}
.student-id-card-profile {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: center;
  flex: 1;
  margin-top: 10px;
}
.student-id-card-photo {
  width: 88px;
  height: 108px;
  border-radius: 14px;
  background: #d1fae5;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #059669;
  font-size: 10px;
  font-weight: 900;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px #0f172a1c;
}
.student-id-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.student-id-card-profile dl {
  margin: 0;
  display: grid;
  gap: 5px;
}
.student-id-card-profile dl div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px;
  min-width: 0;
}
.student-id-card-profile dt {
  font-size: 8px;
  color: #64748b;
  font-weight: 800;
}
.student-id-card-profile dd {
  margin: 0;
  font-size: 10px;
  color: #0f172a;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.student-id-card-front > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 7px;
  color: #64748b;
  font-weight: 700;
}
.student-id-card-front > footer b {
  background: #059669;
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 7px;
}
.student-id-card-back {
  background: linear-gradient(145deg, #032f36, #064e3b);
  color: #fff;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.student-id-card-back:before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border: 34px solid #ffffff0b;
  border-radius: 999px;
  right: -90px;
  top: -90px;
}
.student-id-card-back-brand {
  display: flex;
  gap: 9px;
  align-items: center;
  align-self: flex-start;
  text-align: left;
}
.student-id-card-back-brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}
.student-id-card-back-brand b,
.student-id-card-back-brand span {
  display: block;
}
.student-id-card-back-brand b {
  font-size: 11px;
}
.student-id-card-back-brand span {
  font-size: 8px;
  color: #a7f3d0;
}
.student-id-card-instruction {
  font-size: 8px;
  color: #d1fae5;
  margin: 10px 0 6px;
}
.student-id-card-barcode {
  width: 100%;
  height: 140px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.student-id-card-barcode div {
  width: 120px;
  height: 120px;
}
.student-id-card-barcode div img {
  width: 100%;
  height: 100%;
}
.student-id-card-back h3 {
  font-size: 14px;
  margin: 8px 0 1px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.student-id-card-back > p:not(.student-id-card-instruction) {
  font-size: 9px;
  margin: 0;
  color: #a7f3d0;
}
.student-id-card-back > small {
  font-size: 6.5px;
  color: #a7f3d0;
  margin-top: auto;
  line-height: 1.4;
}
/* Tombol Cetak Kartu */
.student-id-card-print-btn {
  background: #2563eb !important;
  color: #fff !important;
}
.student-id-card-download-btn {
  background: #059669 !important;
  color: #fff !important;
}
.student-id-card-download-btn:hover {
  background: #047857 !important;
}
.student-id-card-print-btn:hover {
  background: #1d4ed8 !important;
}
.student-id-card-print-btn:disabled {
  background: #cbd5e1 !important;
  cursor: not-allowed !important;
}
.student-id-card-print-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}
.student-card-offscreen-qr {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.student-id-card-print-actions button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

/* QR Download Section */
.student-id-card-qr-download {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}
.student-id-card-qr-download b {
  font-size: 13px;
  color: #0f172a;
}
.student-id-card-qr-download p {
  margin: 3px 0 0;
  font-size: 10px;
  color: #64748b;
}
.student-qr-download-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
}
.student-qr-download-image {
  width: 200px;
  height: 200px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.student-qr-download-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.student-qr-download-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.student-qr-download-name {
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.3;
}
.student-qr-download-nis {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}
.student-id-card-qr-download button {
  display: block;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  background: #7c3aed;
  color: #fff;
  white-space: nowrap;
}
.student-id-card-qr-download button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
}
.student-id-card-qr-download button:hover {
  background: #6d28d9;
}

.student-id-card-status {
  min-height: 18px;
  margin: 10px 4px 0;
  font-size: 11px;
  font-weight: 800;
  color: #047857;
}
@media (max-width: 700px) {
  .student-id-card-modal {
    padding: 10px;
  }
  .student-id-card-dialog {
    border-radius: 22px;
  }
  .student-id-card-dialog > main {
    padding: 14px;
  }
  .student-id-card-layout {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 4px 2px 16px;
  }
  .student-id-card {
    flex: 0 0 min(86vw, 390px);
    scroll-snap-align: center;
  }
  .student-id-card-brand h3 {
    font-size: 11px;
  }
  .student-id-card-profile {
    grid-template-columns: 82px 1fr;
  }
  .student-id-card-photo {
    width: 78px;
    height: 96px;
  }
  .student-id-card-profile dl div {
    grid-template-columns: 62px 1fr;
  }
  .student-id-card-qr-download {
    grid-template-columns: 1fr;
  }
  .student-qr-download-wrap {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .student-qr-download-image {
    width: 160px;
    height: 160px;
  }
}

/* Kanvas menjadi satu-satunya sumber visual agar preview, PNG, dan hasil cetak identik. */
.student-id-card.student-id-card-front,
.student-id-card.student-id-card-back {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: initial;
}
.student-id-card.student-id-card-back:before {
  display: none;
}
.student-id-card > canvas {
  display: block;
  width: 100%;
  height: 100%;
}
