:root {
  --paper: #f3efe6;
  --paper-2: #e9e3d6;
  --ink: #17161a;
  --ink-soft: #5d5a62;
  --line: #d6cfbf;
  --brand: #1d4ed8;
  --ok: #157f3b;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 14px;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-display);
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.7), transparent 45%),
    var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- Componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper); font-weight: 600; cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: wait; }

.field { display: grid; gap: 0.35rem; }
.field label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.field input, .field select {
  width: 100%; padding: 0.7rem 0.85rem; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fffdf8;
  transition: border-color 0.2s;
}
.field input:hover { border-color: var(--ink-soft); }
.field small { color: var(--ink-soft); font-size: 0.78rem; }

.error { color: var(--bad); font-size: 0.9rem; min-height: 1.2em; margin: 0; }
.muted { color: var(--ink-soft); }
.mono { font-family: var(--font-mono); }

.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.valida { color: var(--ok); background: rgba(21, 127, 59, 0.1); }
.chip.vencida { color: var(--warn); background: rgba(180, 83, 9, 0.12); }
.chip.revogada { color: var(--bad); background: rgba(185, 28, 28, 0.1); }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden; background: var(--ink); color: var(--paper);
  padding: clamp(2rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: space-between;
}
.auth-art h1 { font-size: clamp(2.4rem, 1rem + 4vw, 4.6rem); line-height: 0.95; margin: 0; letter-spacing: -0.03em; }
.auth-art h1 em { font-style: normal; color: var(--brand); filter: brightness(1.6); }
.auth-art .deco {
  position: absolute; right: -8%; bottom: 12%; width: 62%; aspect-ratio: 85.6 / 54;
  border-radius: 18px; background: linear-gradient(135deg, var(--brand), #0b0b0f);
  transform: rotate(-9deg); box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5); opacity: 0.9;
}
.auth-art .deco::after {
  content: ''; position: absolute; inset: 14% 8% auto auto; width: 22%; aspect-ratio: 3 / 4;
  border-radius: 8px; background: rgba(255, 255, 255, 0.18);
}
.auth-brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 600; position: relative; z-index: 1; }
.auth-brand img { height: 40px; width: auto; border-radius: 6px; background: #fff; padding: 4px; }
.auth-form-wrap { display: grid; place-items: center; padding: 2rem 1rem; }
.auth-form { width: min(380px, 100%); display: grid; gap: 1.1rem; }
.auth-form h2 { margin: 0; font-size: 1.8rem; letter-spacing: -0.02em; }
.auth-form p { margin: 0; }

.remembered { display: grid; justify-items: center; gap: 0.9rem; text-align: center; }
.remembered img {
  width: 112px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px;
  border: 4px solid #fff; box-shadow: 0 0 0 1.5px var(--line), 0 18px 36px -14px rgba(23, 22, 26, 0.45);
}
.remembered strong { display: block; font-size: 1.5rem; letter-spacing: -0.02em; }
.remembered[hidden], .auth-form [hidden] { display: none; }

.quick {
  display: grid; gap: 0.6rem; padding: 0.9rem; margin-top: 0.5rem;
  border: 1.5px dashed var(--warn); border-radius: 12px; background: rgba(180, 83, 9, 0.06);
}
.quick > span { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warn); }
.quick > div { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Layout app ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1.5px solid var(--line);
  background: rgba(243, 239, 230, 0.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.topbar .brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.topbar .brand img { height: 32px; width: auto; }
.wrap { padding: clamp(1rem, 4vw, 2.5rem); max-width: 1280px; margin: 0 auto; }

.tabs { display: flex; gap: 0.25rem; padding: 0.25rem; background: var(--paper-2); border-radius: 999px; width: fit-content; }
.tabs button { border: 0; background: transparent; padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-soft); }
.tabs button[aria-selected='true'] { background: var(--ink); color: var(--paper); }

.panel { background: #fffdf8; border: 1.5px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 3vw, 1.75rem); }
.panel h2 { margin: 0 0 1rem; font-size: 1.25rem; letter-spacing: -0.01em; }

.split { display: grid; grid-template-columns: minmax(400px, 1fr) minmax(320px, 480px); gap: 2rem; align-items: start; margin-top: 1.5rem; }
.sticky { position: sticky; top: 90px; display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }

.photo-drop {
  display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border: 1.5px dashed var(--line);
  border-radius: 12px; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.photo-drop:hover { border-color: var(--ink); background: var(--paper); }
.photo-drop .thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--paper-2) center / cover no-repeat; flex: none; }
.photo-drop.logo .thumb { width: 120px; background-size: contain; background-color: #fff; border: 1px solid var(--line); }
.photo-drop input { display: none; }

.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.member-row {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 0.9rem; align-items: center;
  padding: 0.6rem 0.75rem; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.member-row:hover { background: var(--paper); }
.member-row.active { border-color: var(--ink); background: var(--paper); }
.member-row .avatar { width: 48px; height: 48px; border-radius: 10px; background: var(--paper-2) center / cover no-repeat; }
.member-row strong { display: block; }
.member-row span.mono { font-size: 0.8rem; color: var(--ink-soft); }
.search { margin-bottom: 1rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-soft); }

/* ---------- Carteirinha (Padrão Nacional Documento de Identificação Estudantil - CIE) ---------- */
.card-container {
  container-type: inline-size;
  width: 100%;
  aspect-ratio: 85.6 / 54;
  position: relative;
  perspective: 1200px;
  cursor: pointer;
  user-select: none;
  border-radius: 4.2cqw;
}
.card-container:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}
.card-flipper {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 4.2cqw;
}

.cie-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4.2cqw;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 25px 50px -12px rgba(15, 23, 42, 0.45), 0 8px 18px -4px rgba(15, 23, 42, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 2.2cqw;
  transition:
    transform 0.56s ease-in-out,
    opacity 0s linear 0.28s,
    visibility 0s linear 0.28s;
}

/* ===== FRENTE ===== */
.cie-front {
  background: #243f5e;
  color: #ffffff;
  transform: perspective(1200px) rotateY(0deg);
  opacity: 1;
  visibility: visible;
  z-index: 2;
}
.card-container.is-flipped .cie-front {
  transform: perspective(1200px) rotateY(180deg);
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  pointer-events: none;
}
.cie-green-rim {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2.4cqw;
  background: #22c55e;
  z-index: 3;
  border-radius: 4.2cqw 0 0 4.2cqw;
}
.cie-bg-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.cie-bg-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.cie-watermark {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  transform: rotate(-12deg) scale(1.3);
  opacity: 0.05;
  font-size: 1.4cqw;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.22em;
  white-space: nowrap;
}

/* Cabeçalho */
.cie-head {
  position: absolute;
  top: 2.2cqw;
  left: 4.8cqw;
  right: 4.5cqw;
  height: 7.2cqw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 4;
}
.cie-title {
  margin: 0;
  font-size: 3.3cqw;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.015em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.cie-logo-badge {
  background: #ffffff;
  border-radius: 1.1cqw;
  padding: 0.5cqw 1.2cqw;
  height: 6.8cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  flex: none;
}
.cie-logo-img {
  height: 100%;
  width: auto;
  max-width: 18cqw;
  object-fit: contain;
}
.cie-logo-default-svg {
  height: 100%;
  width: auto;
  max-width: 16cqw;
  display: block;
}

/* Corpo: Foto e campos empilhados */
.cie-body {
  position: absolute;
  top: 10.4cqw;
  bottom: 12.2cqw;
  left: 4.8cqw;
  right: 4.5cqw;
  display: grid;
  grid-template-columns: 26.5cqw 1fr;
  gap: 3.2cqw;
  align-items: stretch;
  z-index: 4;
}
.cie-photo-box {
  width: 26.5cqw;
  height: 100%;
  border: 0.35cqw solid #ffffff;
  border-radius: 1.4cqw;
  overflow: hidden;
  background: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex: none;
}
.cie-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cie-photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #cbd5e1;
  height: 100%;
}
.cie-avatar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cie-fields {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2cqw;
  height: 100%;
  min-width: 0;
}
.cie-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cie-field-label {
  color: #4ade80;
  font-style: italic;
  font-size: 1.8cqw;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.3cqw;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.01em;
}
.cie-field-box {
  background: #ffffff;
  border-radius: 0.8cqw;
  height: 4.2cqw;
  padding: 0 1.2cqw;
  display: flex;
  align-items: center;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.15);
  min-width: 0;
}
.cie-field-val {
  color: #0f172a;
  font-size: 2.1cqw;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  letter-spacing: -0.01em;
}
.cie-field-val.is-name {
  font-size: 2.3cqw;
  font-weight: 800;
  color: #000000;
}

/* Faixa amarela de segurança no rodapé */
.cie-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 11.5cqw;
  background: linear-gradient(90deg, #fde047 0%, #facc15 50%, #fde047 100%);
  display: flex;
  align-items: center;
  padding: 0 2cqw 0 4.8cqw;
  z-index: 5;
  border-radius: 0 0 4.2cqw 4.2cqw;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.15);
}
.cie-bar-year {
  font-size: 5.6cqw;
  font-weight: 900;
  color: #ffffff;
  -webkit-text-stroke: 1.6px #111111;
  letter-spacing: 0.04em;
  margin-right: 2.5cqw;
  line-height: 1;
  flex: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.cie-bar-code-wrap {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  flex: 1;
  min-width: 0;
}
.cie-rosette-svg {
  width: 3.8cqw;
  height: 3.8cqw;
  flex: none;
}
.cie-bar-code {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 3.2cqw;
  color: #111111;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cie-bar-qr {
  position: absolute;
  right: 18.5cqw;
  bottom: 1.1cqw;
  width: 14cqw;
  height: 14cqw;
  background: #ffffff;
  border-radius: 1.1cqw;
  padding: 0.6cqw;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cie-bar-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}
.cie-qr-empty {
  font-size: 2cqw;
  font-weight: 800;
  color: #64748b;
}
.cie-bar-val {
  position: absolute;
  right: 1.8cqw;
  width: 15.5cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
}
.cie-val-lbl {
  font-size: 1.3cqw;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cie-val-date {
  font-size: 1.7cqw;
  font-weight: 800;
  color: #111827;
  margin-top: 0.2cqw;
}

/* Selo de status (revogada ou vencida) */
.cie-status-badge {
  position: absolute;
  top: 18cqw;
  right: 6cqw;
  transform: rotate(-14deg);
  padding: 0.6cqw 2.4cqw;
  border-radius: 0.8cqw;
  font-size: 2.8cqw;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 10;
  pointer-events: none;
  border: 0.3cqw solid #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.cie-status-badge.is-revogada {
  background: #dc2626;
  color: #ffffff;
}
.cie-status-badge.is-vencida {
  background: #d97706;
  color: #ffffff;
}

/* ===== VERSO ===== */
.cie-back {
  background: #1c3249;
  color: #ffffff;
  transform: perspective(1200px) rotateY(-180deg);
  opacity: 0;
  visibility: hidden;
  z-index: 1;
  pointer-events: none;
}
.card-container.is-flipped .cie-back {
  transform: perspective(1200px) rotateY(0deg);
  opacity: 1;
  visibility: visible;
  z-index: 2;
  pointer-events: auto;
}
.cie-back-cyan-rim {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2.4cqw;
  background: #00d2ff;
  z-index: 3;
  border-radius: 4.2cqw 0 0 4.2cqw;
}
.cie-back-watermark {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  transform: rotate(-12deg) scale(1.3);
  opacity: 0.04;
  font-size: 1.4cqw;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.2em;
  white-space: nowrap;
}
.cie-back-head {
  position: absolute;
  top: 3.2cqw;
  left: 5.5cqw;
  right: 4.5cqw;
  z-index: 4;
}
.cie-back-legal {
  color: #fde047;
  font-size: 1.6cqw;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.cie-back-body {
  position: absolute;
  top: 13.5cqw;
  bottom: 12.5cqw;
  left: 5.5cqw;
  right: 4.5cqw;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2cqw;
  align-items: center;
  z-index: 4;
}
.cie-back-data {
  display: flex;
  flex-direction: column;
  gap: 0.8cqw;
}
.cie-back-row {
  display: flex;
  gap: 1cqw;
  font-size: 1.9cqw;
  color: #38bdf8;
}
.cie-back-lbl {
  font-weight: 500;
  min-width: 20cqw;
}
.cie-back-val {
  color: #ffffff;
  font-weight: 700;
}
.cie-back-seal-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 1.2cqw;
  padding: 1.2cqw 1.6cqw;
  text-align: center;
  color: #38bdf8;
  font-size: 1.2cqw;
  font-weight: 700;
  line-height: 1.2;
}
.cie-back-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4cqw;
}
.cie-back-stripe {
  position: absolute;
  bottom: 2.2cqw;
  left: 0;
  right: 0;
  height: 7.5cqw;
  background: #0a0a0a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(0, 0, 0, 0.8);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9);
}

.card-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 85.6 / 54;
  border: 1.5px dashed var(--line);
  border-radius: 20px;
  color: var(--ink-soft);
  text-align: center;
  padding: 1rem;
}

/* Controls de virar carteirinha */
.card-controls {
  display: flex;
  justify-content: center;
  margin-top: -0.25rem;
}

/* ---------- Página do membro / verificação ---------- */
.center-stage { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 2rem 1rem; }
.stage { width: min(560px, 100%); display: grid; gap: 1.25rem; }
.stage .card-container { animation: rise 0.8s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) rotate(-2deg); } to { opacity: 1; transform: none; } }

.verify { text-align: center; display: grid; gap: 1rem; justify-items: center; }
.verify .seal { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; color: #fff; }
.verify .seal.valida { background: var(--ok); }
.verify .seal.vencida { background: var(--warn); }
.verify .seal.revogada, .verify .seal.nao { background: var(--bad); }
.verify .photo { width: 120px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; }
.verify h1 { margin: 0; font-size: 1.6rem; }

.hint { text-align: center; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body, body.is-card-fullscreen { background: #fff !important; margin: 0; padding: 0; overflow: visible !important; }
  .topbar, .no-print, .card-controls, .fs-dock { display: none !important; }
  .center-stage { min-height: 0 !important; height: auto !important; padding: 0 !important; display: block !important; }
  .stage { width: 100% !important; max-width: none !important; height: auto !important; display: block !important; }
  .fs-stage { position: static !important; width: auto !important; height: auto !important; overflow: visible !important; }
  .card-orient-wrap { position: static !important; width: 85.6mm !important; transform: none !important; margin: 10mm auto !important; }
  .card-container {
    box-shadow: none !important;
    width: 85.6mm !important;
    aspect-ratio: 85.6 / 54;
    page-break-inside: avoid;
    margin: 0 auto;
  }
  .card-flipper {
    transform: none !important;
  }
  .cie-card {
    box-shadow: none !important;
    border: 0.25mm solid #cbd5e1;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 260px; }
  .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Biometria Facial & Modais ---------- */
.btn-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-face:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

.divider-or {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}
.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.face-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  margin-top: 0.5rem;
}

/* Modal e Scanner */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 1.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  animation: modalScale 0.25s cubic-bezier(0.34, 1.4, 0.44, 1);
}
@keyframes modalScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.scanner-box {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  background: #0f172a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.scanner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-target {
  width: 200px;
  height: 250px;
  border: 3px dashed rgba(34, 197, 94, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.scanner-target.is-matching {
  border-color: #22c55e;
  border-style: solid;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.4), 0 0 20px #22c55e;
}
.scanner-laser {
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #22c55e, transparent);
  box-shadow: 0 0 8px #22c55e;
  animation: scanSweeper 2s infinite ease-in-out;
}
@keyframes scanSweeper {
  0% { top: 15%; opacity: 0.3; }
  50% { top: 85%; opacity: 1; }
  100% { top: 15%; opacity: 0.3; }
}

.scanner-hint {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
  min-height: 1.4rem;
}
.scanner-hint.success {
  color: #15803d;
  font-weight: 700;
}
.scanner-hint.error {
  color: #dc2626;
  font-weight: 600;
}

/* Banner de Instalação PWA */
.pwa-banner {
  background: linear-gradient(135deg, #1e3a5f 0%, #15273f 100%);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  margin-top: 1rem;
}
.pwa-banner-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
}
.pwa-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: #ffffff;
  padding: 2px;
  flex: none;
}
.pwa-banner strong {
  display: block;
  font-size: 0.95rem;
}
.pwa-banner small {
  opacity: 0.8;
  font-size: 0.8rem;
}

/* ---------- Modo Tela Cheia (Retrato e Deitado / Paisagem) ---------- */
.fs-dock {
  display: none;
}

body.is-card-fullscreen {
  background: radial-gradient(circle at 50% 40%, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  overflow: hidden;
  height: 100dvh;
  width: 100dvw;
  touch-action: manipulation;
}

body.is-card-fullscreen .topbar,
body.is-card-fullscreen .normal-only {
  display: none !important;
}

body.is-card-fullscreen .center-stage {
  min-height: 100dvh;
  height: 100dvh;
  width: 100dvw;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.is-card-fullscreen .stage {
  width: 100dvw;
  max-width: none;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.is-card-fullscreen .fs-stage {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100dvh - 4.25rem - env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

body.is-card-fullscreen .card-orient-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Padrão Retrato (0 graus) */
  width: min(94dvw, calc((100dvh - 5.2rem - env(safe-area-inset-bottom, 0px)) * 85.6 / 54));
  transform: translate(-50%, -50%) rotate(0deg);
  transition: width 0.45s var(--ease), transform 0.45s var(--ease);
}

/* Em aparelhos em pé (Retrato) com Modo Deitado/Expandido ativo: gira 90° e preenche toda a tela */
@media (orientation: portrait) {
  body.is-card-fullscreen.is-card-rotated .card-orient-wrap {
    width: min(
      calc(100dvh - 5.2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)),
      calc(94dvw * 85.6 / 54)
    );
    transform: translate(-50%, -50%) rotate(90deg);
  }
}

/* Quando o celular está fisicamente Deitado (Landscape): preenche toda a tela sem precisar girar 90° */
@media (orientation: landscape) {
  body.is-card-fullscreen .card-orient-wrap,
  body.is-card-fullscreen.is-card-rotated .card-orient-wrap {
    width: min(
      calc(94dvw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)),
      calc((100dvh - 4.5rem - env(safe-area-inset-bottom, 0px)) * 85.6 / 54)
    );
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

/* Barra flutuante inferior no Modo Tela Cheia */
body.is-card-fullscreen .fs-dock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: calc(3.75rem + env(safe-area-inset-bottom, 0px));
  padding: 0.35rem 0.75rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 30;
}

.fs-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.fs-dock-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.fs-dock-btn:active {
  transform: scale(0.96);
}
.fs-dock-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 420px) {
  .fs-dock-btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.76rem;
  }
}


