:root {
  --primary: #d9333d;
  --primary-dark: #b4232c;
  --secondary: #81599f;
  --secondary-soft: #f3ebf8;
  --bg: #f7f4f5;
  --surface: #ffffff;
  --text: #1f1a1c;
  --muted: #6b6066;
  --border: #e6dfe2;
  --success: #1f7a4d;
  --success-bg: #e8f6ee;
  --warn: #9a6b00;
  --warn-bg: #fff6e0;
  --alert: #a33b00;
  --alert-bg: #fff0e8;
  --shadow: 0 18px 50px rgba(31, 26, 28, 0.08);
  --radius: 20px;
  --font: "Inter", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(217, 51, 61, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(129, 89, 159, 0.14), transparent 50%),
    linear-gradient(180deg, #fbf8f9 0%, var(--bg) 100%);
}

body {
  min-height: 100dvh;
}

#app {
  min-height: 100dvh;
}

.screen {
  display: none;
  min-height: 100dvh;
  padding: 24px clamp(16px, 4vw, 40px) 32px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.login-shell {
  margin: auto;
  width: min(920px, 100%);
  display: grid;
  gap: 28px;
}

@media (min-width: 880px) {
  .login-shell {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
  }
}

.login-brand h1 {
  margin: 4px 0 8px;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.brand-eyebrow {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
}

.brand-sub,
.muted {
  color: var(--muted);
}

.logo-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary), #a81f3a);
  color: #fff;
  font-weight: 800;
  font-size: 1.6rem;
  box-shadow: 0 12px 30px rgba(217, 51, 61, 0.35);
  margin-bottom: 18px;
}

.logo-mark.sm {
  width: 44px;
  height: 44px;
  font-size: 1.15rem;
  border-radius: 14px;
  margin: 0;
}

.login-card,
.demo-card,
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 28px;
  display: grid;
  gap: 14px;
}

.login-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(217, 51, 61, 0.35);
  border-color: var(--primary);
}

.form-error {
  margin: 0;
  color: var(--primary);
  font-weight: 600;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(217, 51, 61, 0.28);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--secondary);
  border: 1px solid rgba(129, 89, 159, 0.35);
}

.btn-block {
  width: 100%;
}

.btn-xl {
  width: min(420px, 100%);
  padding: 18px 24px;
  font-size: 1.15rem;
  margin-top: 8px;
}

.btn-text {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.totem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.logo-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-inline strong {
  display: block;
  font-size: 1.05rem;
}

.logo-inline span {
  color: var(--muted);
  font-size: 0.85rem;
}

.totem-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.welcome-kicker {
  margin: 0;
  color: var(--secondary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.welcome-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.welcome-hint {
  margin: 0;
  color: var(--muted);
  max-width: 420px;
}

.cpf-display {
  width: 100%;
  min-height: 88px;
  border-radius: 18px;
  background: var(--surface);
  border: 2px solid rgba(217, 51, 61, 0.2);
  display: grid;
  place-items: center;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
}

.cpf-placeholder {
  color: #c4b7bc;
}

.keypad {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 420px;
}

.keypad button {
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.45rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 26, 28, 0.06);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.12s ease, transform 0.12s ease;
}

.keypad button:active {
  transform: scale(0.96);
  background: var(--secondary-soft);
}

.keypad .key-action {
  font-size: 1rem;
  color: var(--secondary);
}

.privacy {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.center-panel {
  margin: auto;
  width: min(560px, 100%);
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow);
}

.center-panel h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.spinner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 5px solid rgba(129, 89, 159, 0.18);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-icon {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
}

.status-icon.success {
  background: var(--success-bg);
  color: var(--success);
}

.status-icon.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-icon.alert {
  background: var(--alert-bg);
  color: var(--alert);
}

.info-box {
  width: 100%;
  padding: 16px 18px;
  text-align: left;
  display: grid;
  gap: 6px;
  background: var(--secondary-soft);
  border-color: transparent;
  box-shadow: none;
}

.info-box strong {
  display: block;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.auto-return {
  margin: 0;
  font-size: 0.85rem;
}

.demo-main {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.demo-banner {
  background: linear-gradient(90deg, rgba(217, 51, 61, 0.1), rgba(129, 89, 159, 0.12));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 600;
}

.demo-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 800px) {
  .demo-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.demo-card {
  padding: 20px;
}

.demo-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.demo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.demo-list li {
  padding: 12px 14px;
  border-radius: 12px;
  background: #faf7f8;
  border: 1px solid var(--border);
}

.demo-list .cpf {
  font-weight: 700;
  color: var(--primary);
}

.highlight {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--alert);
}

.mt {
  margin-top: 22px;
}

@media (max-width: 480px) {
  .keypad button {
    min-height: 56px;
  }

  .btn-row .btn {
    width: 100%;
  }
}
