.sms-cert-page {
  color: #0f172a;
  padding-bottom: 2rem;
}

.sms-cert-page * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.sms-cert-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sms-cert-title h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.8vw, 2.35rem);
  line-height: 1.05;
  font-weight: 950;
  color: #0f172a;
}

.sms-cert-title p {
  margin: .35rem 0 0;
  color: #64748b;
  font-size: .9rem;
  font-weight: 650;
}

.sms-cert-top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .55rem;
}

.sms-cert-btn,
.sms-cert-icon-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  min-height: 38px;
  padding: .62rem .86rem;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.sms-cert-btn:hover,
.sms-cert-icon-btn:hover {
  border-color: #94a3b8;
}

.sms-cert-btn.primary {
  border-color: transparent;
  color: #fff;
  background: #0f766e;
  box-shadow: 0 12px 24px rgba(15, 118, 110, .2);
}

.sms-cert-btn.blue {
  border-color: transparent;
  color: #fff;
  background: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, .18);
}

.sms-cert-btn.gold {
  border-color: #b8892f;
  color: #ffffff;
  background: #a87823;
}

.sms-cert-btn.danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff7f7;
}

.sms-cert-btn:disabled {
  opacity: .58;
  cursor: not-allowed;
  transform: none;
}

.sms-cert-menu-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2px;
  padding: .75rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 650;
  color: #8ba0bc;
  border: 1px solid transparent;
}

.sms-cert-menu-link.active {
  color: #0f766e;
  background: rgba(15, 118, 110, .08);
  border-color: rgba(15, 118, 110, .16);
  font-weight: 850;
}

.sms-cert-menu-dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: .62rem;
  font-weight: 950;
}

.sms-cert-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .65fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.sms-cert-panel,
.sms-cert-card {
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .06);
}

.sms-cert-panel {
  padding: 1rem;
}

.sms-cert-panel.compact {
  padding: .85rem;
}

.sms-cert-hero-main {
  position: relative;
  overflow: hidden;
  min-height: 170px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(8, 61, 43, .96), rgba(12, 74, 110, .9)),
    url("/campus.jpg") center/cover;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: 8px;
  padding: 1.2rem;
}

.sms-cert-hero-main h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(1.55rem, 2.7vw, 2.2rem);
  line-height: 1.08;
  font-weight: 950;
}

.sms-cert-hero-main p {
  max-width: 760px;
  margin: .7rem 0 0;
  color: #d7f2ea;
  font-weight: 700;
}

.sms-cert-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.sms-cert-stat {
  min-height: 79px;
  padding: .9rem;
  border-radius: 8px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
}

.sms-cert-stat strong {
  display: block;
  color: #0f172a;
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 950;
}

.sms-cert-stat span {
  display: block;
  margin-top: .35rem;
  color: #64748b;
  font-size: .7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.sms-cert-workspace {
  display: grid;
  grid-template-columns: minmax(310px, .8fr) minmax(0, 1.2fr);
  gap: 1rem;
  align-items: start;
}

.sms-cert-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .8rem;
}

.sms-cert-section-title h2,
.sms-cert-section-title h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 950;
}

.sms-cert-section-title span {
  color: #64748b;
  font-size: .74rem;
  font-weight: 800;
}

.sms-cert-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .68rem;
}

.sms-cert-field.wide {
  grid-column: 1 / -1;
}

.sms-cert-label {
  display: block;
  margin-bottom: .32rem;
  color: #475569;
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sms-cert-input,
.sms-cert-select,
.sms-cert-textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: .62rem .72rem;
  background: #fff;
  color: #0f172a;
  font-size: .84rem;
  font-weight: 650;
  outline: none;
}

.sms-cert-select {
  appearance: none;
  padding-right: 2.35rem;
  background-image:
    linear-gradient(45deg, transparent 50%, #475569 50%),
    linear-gradient(135deg, #475569 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 17px,
    calc(100% - 11px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sms-cert-textarea {
  min-height: 92px;
  resize: vertical;
}

.sms-cert-input:focus,
.sms-cert-select:focus,
.sms-cert-textarea:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.sms-cert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .8rem;
}

.sms-cert-dropdown-help {
  margin-top: .38rem;
  min-height: 31px;
  padding: .48rem .58rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: .72rem;
  line-height: 1.35;
  font-weight: 750;
}

.sms-cert-filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(120px, .45fr));
  gap: .55rem;
  margin-bottom: .75rem;
}

.sms-cert-table-wrap {
  overflow: auto;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
}

.sms-cert-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.sms-cert-table th {
  padding: .68rem .72rem;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid #dbe3ef;
  font-size: .68rem;
  font-weight: 950;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.sms-cert-table td {
  padding: .64rem .72rem;
  border-bottom: 1px solid #edf2f7;
  color: #334155;
  font-size: .8rem;
  vertical-align: middle;
}

.sms-cert-table tr:hover td {
  background: #f8fbff;
}

.sms-cert-table td strong {
  color: #0f172a;
  font-weight: 950;
}

.sms-cert-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.sms-cert-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: .28rem .58rem;
  font-size: .68rem;
  font-weight: 900;
  background: #e0f2fe;
  color: #0369a1;
}

.sms-cert-chip.issued {
  background: #dcfce7;
  color: #166534;
}

.sms-cert-chip.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.sms-cert-chip.reissued {
  background: #fef3c7;
  color: #92400e;
}

.sms-cert-chip.profile {
  background: #eef2ff;
  color: #3730a3;
}

.sms-cert-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .85rem;
}

.sms-cert-template-card {
  position: relative;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  min-height: 170px;
}

.sms-cert-template-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--cert-accent, #b8892f);
}

.sms-cert-template-card h3 {
  margin: 0 0 .45rem;
  font-size: 1rem;
  font-weight: 950;
}

.sms-cert-template-card p {
  margin: 0;
  color: #64748b;
  font-size: .82rem;
  line-height: 1.45;
}

.sms-cert-verify-box {
  max-width: 760px;
  margin: 0 auto;
}

.sms-cert-verify-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
}

.sms-cert-verify-result.valid {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.sms-cert-verify-result.invalid {
  border-color: #fecaca;
  background: #fff7f7;
}

.sms-cert-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
}

.sms-cert-report-card {
  padding: 1rem;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
}

.sms-cert-report-card strong {
  display: block;
  font-size: 1.7rem;
  color: #0f172a;
  font-weight: 950;
}

.sms-cert-report-card span {
  display: block;
  margin-top: .35rem;
  color: #64748b;
  font-size: .72rem;
  text-transform: uppercase;
  font-weight: 900;
}

.sms-cert-note {
  color: #64748b;
  font-size: .76rem;
  font-weight: 750;
  line-height: 1.45;
}

.sms-cert-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10000;
  max-width: 360px;
  padding: .85rem 1rem;
  border-radius: 8px;
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #065f46;
  box-shadow: 0 20px 45px rgba(15, 23, 42, .18);
  font-size: .84rem;
  font-weight: 850;
}

.sms-cert-toast.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

@media (max-width: 1120px) {
  .sms-cert-hero,
  .sms-cert-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sms-cert-top {
    flex-direction: column;
  }

  .sms-cert-top-actions {
    justify-content: flex-start;
  }

  .sms-cert-form,
  .sms-cert-filter-row {
    grid-template-columns: 1fr;
  }

  .sms-cert-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sms-cert-table {
    min-width: 720px;
  }

  .sms-cert-panel {
    padding: .85rem;
  }
}

@media print {
  .sms-cert-page,
  .sms-sidebar,
  .sms-header,
  .sms-mobile-menu,
  .sms-mobile-overlay {
    display: none !important;
  }
}

.cert-print-body {
  margin: 0;
  background: #eef2f7;
  color: #0f172a;
  font-family: Arial, sans-serif;
}

.cert-print-body *,
.cert-print-body *::before,
.cert-print-body *::after {
  box-sizing: border-box;
}

.cert-print-actions {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid #dbe3ef;
}

.cert-print-actions button {
  border: 0;
  border-radius: 7px;
  padding: 9px 13px;
  background: #0f766e;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.cert-print-sheet {
  width: 270mm;
  min-height: 0;
  margin: 8mm auto;
  padding: 0;
}

.cert-document {
  --cert-brand: #063d2b;
  --cert-gold: #bf9638;
  --cert-ink: #071525;
  position: relative;
  width: 270mm;
  height: 180mm;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(191, 150, 56, .12), transparent 28%),
    linear-gradient(135deg, rgba(6, 61, 43, .045), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
  border: 1.2mm solid var(--cert-brand);
  border-radius: 2mm;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .16);
  box-sizing: border-box;
  margin: 0 auto 8mm;
  break-inside: avoid;
  page-break-inside: avoid;
  break-after: auto;
  page-break-after: auto;
}

.cert-document::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4mm;
  background: linear-gradient(90deg, var(--cert-brand), var(--cert-gold), var(--cert-accent, #b8892f), var(--cert-brand));
}

.cert-document::after {
  content: "";
  position: absolute;
  inset: 5mm;
  border: .28mm solid rgba(15, 23, 42, .22);
  border-radius: 1mm;
  pointer-events: none;
}

.cert-document:not(:last-child) {
  break-after: page;
  page-break-after: always;
}

.cert-document.formal,
.cert-document.premium {
  background:
    radial-gradient(circle at 50% 18%, rgba(191, 150, 56, .13), transparent 28%),
    linear-gradient(135deg, rgba(6, 61, 43, .045), transparent 26%),
    linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.cert-document.sports {
  background:
    radial-gradient(circle at 85% 18%, rgba(14, 165, 233, .14), transparent 25%),
    linear-gradient(135deg, #ffffff, #f0f9ff);
}

.cert-document.event {
  background:
    radial-gradient(circle at 14% 85%, rgba(37, 99, 235, .12), transparent 26%),
    linear-gradient(135deg, #ffffff, #eef4ff);
}

.cert-inner {
  position: absolute;
  inset: 7mm;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: calc(100% - 14mm);
  padding: 6mm 11mm 5mm;
}

.cert-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: .055;
  pointer-events: none;
}

.cert-watermark img {
  width: 70mm;
  height: 70mm;
  object-fit: contain;
}

.cert-head {
  display: grid;
  grid-template-columns: 23mm 1fr 25mm;
  gap: 7mm;
  align-items: center;
  position: relative;
  z-index: 1;
}

.cert-head img.logo {
  width: 21mm;
  height: 21mm;
  object-fit: contain;
}

.cert-school {
  text-align: center;
}

.cert-school h1 {
  margin: 0;
  font-size: 18pt;
  line-height: 1.05;
  font-weight: 950;
  color: var(--cert-ink);
}

.cert-school p {
  margin: 1.4mm 0 0;
  font-size: 7.6pt;
  color: #475569;
  font-weight: 800;
}

.cert-qr {
  width: 23mm;
  height: 23mm;
  padding: 1mm;
  border: .3mm solid #cbd5e1;
  background: #fff;
  object-fit: contain;
}

.cert-title {
  margin: 8mm 0 0;
  text-align: center;
  position: relative;
  z-index: 1;
}

.cert-title h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23pt;
  line-height: 1.02;
  font-weight: 700;
  color: var(--cert-accent, #b8892f);
  text-transform: uppercase;
}

.cert-title span {
  display: block;
  margin-top: 2mm;
  font-size: 8pt;
  color: #64748b;
  font-weight: 850;
  text-transform: uppercase;
}

.cert-recipient {
  margin: 6mm auto 0;
  max-width: 190mm;
  text-align: center;
  position: relative;
  z-index: 1;
}

.cert-recipient .awarded {
  margin: 0 0 2.6mm;
  color: #64748b;
  font-size: 9pt;
  font-weight: 800;
}

.cert-recipient h3 {
  margin: 0;
  padding: 0 0 1.4mm;
  border-bottom: .45mm solid rgba(15, 23, 42, .25);
  font-family: Georgia, "Times New Roman", serif;
  color: var(--cert-ink);
  font-size: 27pt;
  line-height: 1.05;
}

.cert-body {
  margin: 5mm auto 0;
  max-width: 210mm;
  text-align: center;
  color: #334155;
  font-size: 10.4pt;
  line-height: 1.45;
  font-weight: 650;
  position: relative;
  z-index: 1;
}

.cert-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3mm;
  margin: 6mm auto 0;
  max-width: 220mm;
  width: 100%;
  position: relative;
  z-index: 1;
}

.cert-meta div {
  border: .3mm solid #dbe3ef;
  border-radius: 2mm;
  padding: 1.8mm 2mm;
  background: rgba(248, 250, 252, .9);
}

.cert-meta span {
  display: block;
  color: #64748b;
  font-size: 6.4pt;
  font-weight: 900;
  text-transform: uppercase;
}

.cert-meta strong {
  display: block;
  margin-top: .8mm;
  color: var(--cert-ink);
  font-size: 7.8pt;
  font-weight: 900;
}

.cert-foot {
  margin-top: auto;
  padding: 6mm 5mm 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10mm;
  align-items: end;
  position: relative;
  z-index: 2;
}

.cert-sign {
  min-height: 22mm;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: center;
  color: var(--cert-ink);
}

.cert-sign img {
  max-width: 35mm;
  max-height: 10mm;
  object-fit: contain;
  display: block;
  margin: 0 auto -1mm;
}

.cert-sign-line {
  display: block;
  width: 100%;
  min-height: 12mm;
  border-bottom: .35mm solid #0f172a;
  margin: 0 auto 1.6mm;
}

.cert-sign strong {
  display: block;
  font-size: 8pt;
  font-weight: 950;
}

.cert-sign small {
  display: block;
  margin-top: .6mm;
  color: #64748b;
  font-size: 5.8pt;
  font-weight: 850;
  text-transform: uppercase;
}

.cert-seal {
  position: absolute;
  left: 50%;
  bottom: 23mm;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 1;
}

.cert-seal img {
  width: 22mm;
  height: 22mm;
  object-fit: contain;
  opacity: .78;
}

.cert-number {
  position: relative;
  z-index: 2;
  margin-top: 3mm;
  color: #64748b;
  font-size: 6.2pt;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
  html,
  body.cert-print-body {
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .cert-print-body {
    background: #fff;
  }

  .cert-print-actions {
    display: none;
  }

  .cert-print-sheet {
    width: 270mm;
    min-height: 0;
    margin: 10mm auto 0;
    padding: 0;
  }

  .cert-document {
    width: 270mm;
    height: 180mm;
    margin: 0 auto;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: auto;
    page-break-after: auto;
  }

  .cert-document:not(:last-child) {
    break-after: page;
    page-break-after: always;
  }

  .cert-document:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
