@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap");

:root {
  --maroon: #7a191b;
  --maroon-dark: #5f1013;
  --gold: #c5a059;
  --cream: #f8f5f0;
  --paper: #ffffff;
  --paper-soft: #fbfaf8;
  --ink: #2c2c2c;
  --muted: #77716b;
  --line: #ebebeb;
  --line-gold: rgba(197, 160, 89, .38);
  --danger: #b42318;
  --success: #0f6f45;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, .05);
  --shadow-lift: 0 18px 44px rgba(44, 44, 44, .09);
  --font-heading: "Playfair Display", Georgia, serif;
  --font-body: "Montserrat", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: inherit;
}

.topbar {
  align-items: center;
  background: rgba(248, 245, 240, .94);
  border-bottom: 1px solid rgba(197, 160, 89, .2);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px 36px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  border-radius: 50%;
  height: 46px;
  object-fit: cover;
  width: 46px;
}

.brand span,
.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--maroon);
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

.brand small,
nav a,
.eyebrow,
.section-kicker,
label,
.data-table th,
.cert-a5-label {
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.brand small {
  color: var(--muted);
  margin-top: 4px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

nav a {
  border-radius: 4px;
  color: #5f5751;
  padding: 8px 10px;
  text-decoration: none;
  transition: color .2s ease, background .2s ease;
}

nav a:hover {
  background: rgba(197, 160, 89, .1);
  color: var(--maroon);
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 38px 22px 72px;
}

h1,
h2,
h3,
.tile strong,
.stats strong,
.cert-a5-value {
  font-family: var(--font-heading);
}

.hero,
.verify {
  align-items: center;
  background: var(--paper);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 44px;
  grid-template-columns: 1.08fr .92fr;
  padding: 56px;
}

.hero h1,
.verify h1,
.panel h1,
.login-panel h1 {
  color: var(--ink);
  font-size: 2.7rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0 0 14px;
}

.hero p,
.verify p,
.muted {
  color: var(--muted);
}

.hero p,
.verify p {
  font-size: 1rem;
  max-width: 620px;
}

.eyebrow,
.section-kicker {
  color: var(--gold);
  margin: 0 0 12px;
}

.section-kicker {
  color: var(--maroon);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.stats {
  display: grid;
  gap: 14px;
}

.stats div,
.tile,
.panel,
.login-panel,
.certificate-a5,
.verify-form {
  background: var(--paper);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.stats div {
  border: 1px solid rgba(197, 160, 89, .2);
  padding: 24px;
}

.stats strong {
  color: var(--maroon);
  display: block;
  font-size: 2.3rem;
  font-weight: 600;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  display: block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  margin-top: 8px;
  text-transform: uppercase;
}

.quick-actions {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 22px;
}

.tile {
  border: 1px solid transparent;
  min-height: 136px;
  padding: 26px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.tile:hover {
  border-color: var(--line-gold);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.tile strong,
.tile span {
  display: block;
}

.tile strong {
  color: var(--maroon);
  font-size: 1.45rem;
  font-weight: 600;
}

.tile span {
  color: var(--muted);
  font-size: .88rem;
  margin-top: 10px;
}

.panel,
.login-panel {
  padding: 36px;
}

.wide {
  max-width: none;
}

.login-panel {
  margin: 44px auto;
  max-width: 470px;
}

.luxury-panel {
  background: var(--paper);
  border: 0;
  box-shadow: var(--shadow-soft);
}

.login-header {
  align-items: center;
  display: flex;
  flex-direction: column;
  margin-bottom: 34px;
  text-align: center;
}

.login-logo,
.verify-logo {
  border-radius: 50%;
  display: block;
  height: 92px;
  margin: 0 auto 22px;
  object-fit: cover;
  width: 92px;
}

.login-header .eyebrow {
  margin-bottom: 8px;
}

.login-header h1 {
  margin-bottom: 0;
}

.form-grid,
.grid {
  display: grid;
  gap: 20px;
}

.grid.two {
  grid-template-columns: repeat(2, 1fr);
}

label {
  color: #514b46;
  display: grid;
  gap: 9px;
}

input,
select,
textarea {
  background: var(--paper-soft);
  border: 1px solid #eaeaea;
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .95rem;
  padding: 15px 16px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  background: #fff;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(197, 160, 89, .12);
  outline: none;
}

textarea {
  resize: vertical;
}

button,
.button {
  align-items: center;
  background: var(--maroon);
  border: 1px solid var(--maroon);
  border-radius: 4px;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  justify-content: center;
  letter-spacing: 1.2px;
  min-height: 46px;
  padding: 13px 20px;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

button:hover,
.button:hover {
  background: var(--maroon-dark);
  box-shadow: 0 12px 26px rgba(122, 25, 27, .18);
  transform: translateY(-1px);
}

.gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.glass,
.ghost {
  background: transparent;
  border-color: var(--line-gold);
  color: var(--maroon);
}

.glass:hover,
.ghost:hover {
  background: rgba(197, 160, 89, .08);
  color: var(--maroon);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.actions.compact {
  margin-top: 0;
}

.section-head {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 850px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 18px 12px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
}

.data-table tbody tr {
  transition: background .2s ease;
}

.data-table tbody tr:hover {
  background: rgba(197, 160, 89, .06);
}

.data-table td span {
  color: var(--muted);
  display: block;
  font-size: .82rem;
  margin-top: 4px;
}

.table-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.table-actions a,
.table-actions button {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--maroon);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: 1px;
  min-height: auto;
  padding: 0;
}

.badge {
  background: rgba(15, 111, 69, .08);
  border-radius: 999px;
  color: var(--success) !important;
  display: inline-block !important;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 6px 10px;
  text-transform: uppercase;
}

.muted-badge {
  background: #f0ede8;
  color: var(--muted) !important;
}

.image-preview {
  align-items: center;
  background: var(--paper-soft);
  border: 1px dashed #dedbd6;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 220px;
  overflow: hidden;
}

.image-preview img {
  max-height: 300px;
  max-width: 100%;
}

.alert,
.success {
  border-radius: 4px;
  font-size: .9rem;
  font-weight: 500;
  padding: 13px 15px;
}

.alert {
  background: #fff1f0;
  color: var(--danger);
}

.success {
  background: rgba(15, 111, 69, .08);
  color: var(--success);
}

.verify-form {
  display: grid;
  gap: 18px;
  padding: 30px;
}

.certificate-a5 {
  background: #fff;
  box-shadow: 0 18px 48px rgba(44, 44, 44, .12);
  margin: 24px auto;
  height: 210mm;
  outline: 1px solid var(--gold);
  outline-offset: -6mm;
  overflow: hidden;
  padding: 10mm 11mm 13mm;
  position: relative;
  width: 148mm;
}

.certificate-a5::before {
  border: 1px solid var(--gold);
  content: "";
  inset: 5mm;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.cert-watermark {
  height: 115mm;
  left: 50%;
  object-fit: contain;
  opacity: .03;
  pointer-events: none;
  position: absolute;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 115mm;
  z-index: 0;
}

.cert-a5-header,
.cert-a5-product,
.cert-a5-divider,
.cert-a5-grid,
.cert-a5-footer,
.cert-a5-secret {
  position: relative;
  z-index: 1;
}

.cert-a5-header {
  align-items: center;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.cert-a5-logo {
  border-radius: 0;
  display: block;
  height: 20mm;
  margin: 0 auto 5mm;
  object-fit: contain;
  width: 34mm;
}

.cert-a5-logo-space {
  align-items: center;
  display: flex;
  height: 20mm;
  justify-content: center;
  margin: 0 auto 5mm;
  width: 100mm;
}

.cert-screen-wordmark {
  display: block;
  height: auto;
  max-height: 16mm;
  max-width: 100mm;
  object-fit: contain;
  width: 100mm;
}

.download-page .cert-screen-wordmark,
.pdf-exporting .cert-screen-wordmark {
  display: none !important;
}

.cert-a5-kicker {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 7.5pt;
  font-weight: 600;
  letter-spacing: 1.8px;
  line-height: 1.2;
  margin: 0 0 2mm;
  text-transform: uppercase;
}

.cert-a5-header h1 {
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 18pt;
  font-weight: 600;
  letter-spacing: 2.4px;
  line-height: 1.1;
  margin: 0;
  text-transform: uppercase;
}

.cert-report-number {
  color: var(--maroon);
  font-family: var(--font-body);
  font-size: 7.5pt;
  font-weight: 600;
  letter-spacing: 1.4px;
  line-height: 1;
  margin: 2.5mm 0 0;
  text-transform: uppercase;
}

.cert-a5-product {
  display: flex;
  justify-content: center;
  margin: 6mm 0 3.5mm;
}

.cert-a5-photo {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(197, 160, 89, .42);
  color: var(--muted);
  display: flex;
  height: 32mm;
  justify-content: center;
  padding: 5px;
  width: 32mm;
}

.cert-a5-photo img {
  display: block;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.cert-a5-divider {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 0 auto 3mm;
  width: 72mm;
}

.cert-a5-divider::before,
.cert-a5-divider::after {
  background: linear-gradient(90deg, transparent, rgba(197, 160, 89, .48));
  content: "";
  height: 1px;
  flex: 1;
}

.cert-a5-divider::after {
  background: linear-gradient(90deg, rgba(197, 160, 89, .48), transparent);
}

.cert-a5-divider span {
  border: 1px solid var(--gold);
  height: 4px;
  margin: 0 7px;
  transform: rotate(45deg);
  width: 4px;
}

.cert-a5-grid {
  margin: 0 auto;
  max-height: 76mm;
  overflow: hidden;
  width: 108mm;
}

.cert-a5-row {
  align-items: baseline;
  border-bottom: 1px dotted rgba(197, 160, 89, .32);
  display: grid;
  gap: 6mm;
  grid-template-columns: 40mm 1fr;
  min-height: 5.4mm;
  padding: .8mm 0;
}

.cert-a5-label {
  color: #9a8f80;
  font-size: 7.2pt;
  line-height: 1.2;
}

.cert-a5-value {
  color: var(--ink);
  font-family: var(--font-heading);
  font-size: 10.8pt;
  font-weight: 500;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.cert-a5-footer {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  margin: 5mm auto 0;
  width: 108mm;
}

.cert-a5-qr {
  color: var(--muted);
  display: grid;
  font-family: var(--font-body);
  font-size: 6.8pt;
  gap: 1mm;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

.cert-a5-qr img {
  border: 1px solid #e6dfd3;
  display: block;
  height: 14mm;
  padding: 1.5mm;
  width: 14mm;
}

.cert-a5-signature {
  color: var(--muted);
  display: grid;
  font-family: var(--font-body);
  font-size: 7pt;
  font-weight: 600;
  gap: 2mm;
  letter-spacing: 1.5px;
  min-width: 42mm;
  text-align: center;
  text-transform: uppercase;
}

.cert-a5-signature span {
  border-bottom: 1px solid var(--gold);
  display: flex;
  height: 12mm;
  justify-content: center;
  overflow: hidden;
  padding-bottom: 1mm;
}

.cert-a5-signature img {
  display: block;
  height: 15mm;
  max-width: 42mm;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.cert-a5-secret {
  bottom: 8mm;
  color: #aaa39a;
  font-family: var(--font-body);
  font-size: 6.8pt;
  left: 50%;
  letter-spacing: 1px;
  position: absolute;
  text-align: center;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.certificate-print-view {
  display: grid;
  justify-items: center;
}

.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin: 0 auto 18px;
  width: 148mm;
}

.print-button,
.pdf-button {
  margin-top: 0;
}

.pdf-button {
  background: #fff;
  border-color: var(--maroon);
  color: var(--maroon);
}

.pdf-button:hover {
  background: rgba(122, 25, 27, .05);
  color: var(--maroon);
}

.download-page {
  display: grid;
  justify-items: center;
  padding: 24px;
}

@media (max-width: 860px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 14px 18px;
  }

  nav {
    justify-content: flex-start;
  }

  .hero,
  .verify,
  .grid.two,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .hero,
  .verify,
  .panel,
  .login-panel {
    padding: 28px;
  }

  .hero h1,
  .verify h1,
  .panel h1,
  .login-panel h1 {
    font-size: 2.1rem;
  }

  .certificate-a5 {
    transform: scale(.72);
    transform-origin: top center;
  }

  .print-actions {
    margin-bottom: 14px;
    width: 100%;
  }
}

@page {
  size: A5 portrait;
  margin: 0;
}

@media print {
  html,
  body {
    background: #fff !important;
    height: 210mm;
    margin: 0 !important;
    overflow: hidden;
    padding: 0 !important;
    width: 148mm;
  }

  body * {
    visibility: hidden;
  }

  .certificate-a5,
  .certificate-a5 * {
    visibility: visible;
  }

  .topbar,
  .print-actions,
  .print-button,
  .cert-screen-wordmark,
  .actions,
  .button {
    display: none !important;
  }

  main {
    margin: 0 !important;
    max-width: none !important;
    padding: 0 !important;
  }

  .panel,
  .login-panel {
    box-shadow: none !important;
    padding: 0 !important;
  }

  .certificate-a5 {
    box-shadow: none !important;
    height: 210mm;
    left: 0;
    margin: 0 !important;
    min-height: 210mm;
    page-break-after: avoid;
    page-break-before: avoid;
    page-break-inside: avoid;
    position: absolute;
    top: 0;
    transform: none !important;
    width: 148mm;
  }
}
