/* Consulta CNH Digital — Detalhamento (mobile-first, fluido) */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #f0f0f0;
  color: #333;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── Header ── */
.header {
  background-color: #6baa3d;
  color: #fff;
  padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100vw;
}

.back-button {
  font-size: 32px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  color: #fff;
  border: 0;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 400;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-button {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6baa3d;
  font-weight: 700;
  font-size: 14px;
}

/* ── Content ── */
.content {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  background: #f0f0f0;
  min-height: calc(100dvh - 56px);
  overflow-x: hidden;
}

.title {
  text-align: center;
  font-size: clamp(1.5rem, 6.5vw, 2rem);
  color: #444;
  margin: 0 0 4px;
  font-weight: 400;
  line-height: 1.2;
}

.subtitle {
  text-align: center;
  color: #777;
  margin: 0 0 10px;
  font-size: 0.875rem;
}

.status-pill {
  text-align: center;
  font-size: 0.8125rem;
  margin: 0 0 16px;
  font-weight: 600;
  line-height: 1.4;
  padding: 0 4px;
  word-break: break-word;
}
.status-pill.ok { color: #047857; }
.status-pill.preview { color: #b45309; }
.status-pill.err { color: #b91c1c; }

/* ── Foto 3×4 ── */
.photo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto 22px;
  gap: 6px;
  width: 100%;
}

.photo-container {
  width: min(140px, 38vw);
  height: min(186px, 50.5vw);
  border: 4px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden;
}

.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.photo-placeholder {
  color: #bbb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 8px;
  line-height: 1.3;
}

.photo-caption {
  font-size: 12px;
  color: #6baa3d;
  font-weight: 700;
}

/* ── Seções / campos ── */
.section-title {
  color: #6baa3d;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #cfe8b8;
  width: 100%;
}

.info-row {
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.info-label {
  color: #6baa3d;
  font-size: 0.8125rem;
  margin-bottom: 4px;
  line-height: 1.3;
}

.info-value {
  font-size: clamp(1.05rem, 4.8vw, 1.35rem);
  color: #333;
  padding-bottom: 8px;
  border-bottom: 1px solid #ccc;
  min-height: 1.35em;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
  max-width: 100%;
}

.badge-cat {
  display: inline-block;
  background: #6baa3d;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  padding: 4px 12px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  min-width: 2em;
  text-align: center;
}

/* ── Assinatura (só tinta, sem fundo) ── */
.sign-box {
  margin: 0.15rem 0 0.4rem;
  padding: 0.5rem 0 0.15rem;
  background: transparent !important;
  border: none;
  border-bottom: 1.5px solid #999;
  border-radius: 0;
  text-align: center;
  min-height: 64px;
  max-width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
  box-shadow: none;
}

.sign-img {
  max-width: min(100%, 300px);
  max-height: 72px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  background: transparent !important;
  border: 0;
  box-shadow: none;
  /* se o PNG ainda tiver fundo branco, some na página clara */
  mix-blend-mode: darken;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* ── Foot / loading ── */
.foot {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #ddd;
  font-size: 0.7rem;
  color: #888;
  line-height: 1.45;
  text-align: center;
  word-break: break-word;
}

.loading {
  text-align: center;
  color: #666;
  padding: 2.5rem 0.5rem;
  font-size: 0.95rem;
}

/* ── Mobile estreito ── */
@media (max-width: 400px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .header { padding-left: 10px; padding-right: 10px; }
  .header-title { font-size: 1.1rem; }
  .info-value { font-size: 1.05rem; }
  .photo-container {
    width: 120px;
    height: 160px;
    border-width: 3px;
  }
  .sign-img { max-height: 68px; }
}

/* Desktop conforto */
@media (min-width: 560px) {
  .content { padding: 24px 20px 48px; }
  .title { font-size: 2rem; }
  .info-value { font-size: 1.35rem; }
  .photo-container {
    width: 150px;
    height: 200px;
    border-width: 5px;
  }
}
