.cafr-defined-card-host,
.cafr-public-card-section {
  width: 100%;
  margin: 24px 0;
}

.cafr-id-card {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 1011 / 638;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 24px;
  background: #ffffff;
  color: #102f5b;
  box-shadow: 0 22px 60px rgba(3, 21, 45, 0.28);
  font-family: Inter, Arial, sans-serif;
  border: 1px solid rgba(16, 47, 91, 0.14);
}

.cafr-id-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

.cafr-card-top {
  position: relative;
  height: 45%;
  display: flex;
  align-items: center;
  gap: 4.2%;
  padding: 4.2% 5.5%;
  color: #ffffff;
  background:
    radial-gradient(circle at 82% 12%, rgba(76, 148, 231, 0.28), transparent 30%),
    linear-gradient(135deg, #092f72 0%, #0a428f 55%, #0d57ae 100%);
}

.cafr-card-top::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image:
    linear-gradient(30deg, transparent 47%, rgba(255,255,255,.65) 48%, transparent 49%),
    linear-gradient(150deg, transparent 47%, rgba(255,255,255,.45) 48%, transparent 49%);
  background-size: 58px 58px;
}

.cafr-card-logo {
  position: relative;
  z-index: 1;
  width: 18%;
  height: 74%;
  object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(0,0,0,.22));
}

.cafr-card-brand {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.cafr-card-brand strong {
  display: block;
  margin: 0;
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-size: clamp(2rem, 6.7vw, 5.2rem);
  line-height: .9;
  font-weight: 800;
  letter-spacing: .02em;
}

.cafr-card-brand span {
  display: block;
  margin-top: 4.5%;
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-size: clamp(.64rem, 1.55vw, 1.2rem);
  line-height: 1.42;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.cafr-card-tricolor {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 43.6%;
  height: 2.2%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.cafr-card-tricolor i:nth-child(1) { background: #ffffff; }
.cafr-card-tricolor i:nth-child(2) { background: #d71920; }
.cafr-card-tricolor i:nth-child(3) { background: #4a86cf; }

.cafr-card-bottom {
  position: relative;
  height: 55%;
  padding: 4.2% 5.5% 3.4%;
  background:
    linear-gradient(90deg, rgba(18, 79, 151, .035) 1px, transparent 1px),
    linear-gradient(rgba(18, 79, 151, .035) 1px, transparent 1px),
    #ffffff;
  background-size: 34px 34px;
}

.cafr-card-type {
  margin: 0 0 3.1%;
  color: #0a3979;
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-size: clamp(.95rem, 2.45vw, 1.92rem);
  font-weight: 800;
  letter-spacing: .035em;
}

.cafr-card-data {
  width: 66%;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8% 8%;
}

.cafr-card-field-name {
  grid-column: 1 / -1;
}

.cafr-card-field small {
  display: block;
  margin-bottom: 2.7%;
  color: #5275a4;
  font-size: clamp(.52rem, 1.02vw, .82rem);
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.cafr-card-field strong {
  display: block;
  color: #102f5b;
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-size: clamp(.78rem, 1.75vw, 1.35rem);
  line-height: 1.15;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.cafr-card-field-name strong {
  font-size: clamp(1.02rem, 3.2vw, 2.55rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cafr-card-status {
  display: inline-flex !important;
  align-items: center;
  gap: .45em;
  color: #15803d !important;
}

.cafr-card-status::before {
  content: "";
  width: .58em;
  height: .58em;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.cafr-card-status.is-pending { color: #a76b00 !important; }
.cafr-card-status.is-suspended,
.cafr-card-status.is-invalid { color: #b42318 !important; }

.cafr-card-qr-box {
  position: absolute;
  right: 5.2%;
  top: 21%;
  width: 25.3%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 2.1%;
  border-radius: 13%;
  background: #ffffff;
  border: 2px solid #dbe4ef;
  box-shadow: 0 10px 26px rgba(12, 52, 103, .12);
}

.cafr-card-qr-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.cafr-card-footer {
  position: absolute;
  left: 5.5%;
  right: 34%;
  bottom: 4.2%;
  color: #8090a5;
  font-size: clamp(.42rem, .82vw, .68rem);
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.cafr-card-phone-note {
  margin: 16px 0 0;
  text-align: center;
  color: #64748b;
  font-size: .92rem;
  line-height: 1.5;
}

.cafr-public-card-section {
  margin-top: 30px;
}

.cafr-public-card-section + .verify-card {
  margin-top: 28px;
}

/* Administrator card: same complete card, only smaller inside the profile modal. */
.cafr-defined-card-host-admin {
  max-width: 740px;
  margin: 18px auto 24px;
}

.cafr-defined-card-host-admin .cafr-id-card {
  width: min(100%, 680px);
  border-radius: 18px;
  box-shadow: 0 16px 42px rgba(3, 21, 45, 0.24);
}

.cafr-defined-card-host-admin .cafr-card-phone-note {
  font-size: .84rem;
}

/* Keep card data dark and readable even when the website uses dark mode. */
html.theme-dark .cafr-id-card {
  background: #ffffff !important;
  color: #102f5b !important;
}

html.theme-dark .cafr-id-card .cafr-card-brand strong,
html.theme-dark .cafr-id-card .cafr-card-brand span {
  color: #ffffff !important;
}

html.theme-dark .cafr-id-card .cafr-card-type {
  color: #0a3979 !important;
}

html.theme-dark .cafr-id-card .cafr-card-field small {
  color: #5275a4 !important;
}

html.theme-dark .cafr-id-card .cafr-card-field strong {
  color: #102f5b !important;
}

html.theme-dark .cafr-id-card .cafr-card-status {
  color: #15803d !important;
}

html.theme-dark .cafr-id-card .cafr-card-status.is-pending {
  color: #a76b00 !important;
}

html.theme-dark .cafr-id-card .cafr-card-status.is-suspended,
html.theme-dark .cafr-id-card .cafr-card-status.is-invalid {
  color: #b42318 !important;
}

html.theme-dark .cafr-id-card .cafr-card-footer {
  color: #8090a5 !important;
}

html.theme-dark .cafr-card-phone-note {
  color: #b8c6d8 !important;
}

/* Keep administration on a second line so the desktop header does not stretch. */
@media (min-width: 1101px) {
  .topbar .actions {
    max-width: 330px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-content: center;
    row-gap: 5px;
  }

  .topbar .actions #adminPanelBtn {
    order: 10;
    flex: 0 0 100%;
    padding: 2px 0 0;
    text-align: right;
  }
}

@media (max-width: 680px) {
  .cafr-id-card {
    border-radius: 15px;
  }

  .cafr-card-top {
    padding-left: 4.6%;
    padding-right: 4.6%;
  }

  .cafr-card-logo {
    width: 19%;
  }

  .cafr-card-bottom {
    padding-left: 4.8%;
    padding-right: 4.8%;
  }

  .cafr-card-data {
    width: 67%;
    gap: 7% 6%;
  }

  .cafr-card-qr-box {
    right: 4.2%;
    width: 26%;
  }

  .cafr-card-footer {
    left: 4.8%;
    right: 34%;
  }

  .cafr-defined-card-host-admin {
    max-width: 100%;
  }
}
