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

/* Cores de superfície e texto vêm dos tokens da identidade KSI (/css/ksi/tokens.css), nos dois temas.
   Destaque (botão Entrar, bordas, brilhos, marcadores): o vermelho desta tela, ou a cor de destaque da
   marca (marcas.yml), que redefine --accent, --accent-dark, --accent-glow e as versões -rgb. */
:root {
  --bg-left: var(--surface-0);
  --bg-card: var(--surface-1);
  --bg-input: #f8fafc;
  --text-primary: var(--ink);
  --text-secondary: var(--ink-muted);
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --accent: #d41c1c;
  --accent-dark: #aa0000;
  --accent-rgb: 212, 28, 28;
  --accent-dark-rgb: 170, 0, 0;
  --accent-glow: rgba(212, 28, 28, 0.12);
  --navy: var(--brand-primary);
}

html.dark {
  --bg-input: #0a1628;
  --text-muted: #475569;
  --border: #1e3a5a;
  --accent-glow: rgba(212, 28, 28, 0.2);
}

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  display: flex;
  min-height: 100vh;
  background: var(--bg-left);
  transition: background 0.3s;
}

.panel-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  background: var(--bg-left);
}

.orb-left {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.orb-l1 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.07), transparent 70%);
  top: -5%; left: -8%;
  animation: driftL1 16s ease-in-out infinite;
}

.orb-l2 {
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(var(--accent-dark-rgb), 0.05), transparent 70%);
  bottom: 10%; right: -5%;
  animation: driftL2 20s ease-in-out infinite;
}

.orb-l3 {
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.04), transparent 70%);
  top: 40%; left: 50%;
  animation: driftL3 14s ease-in-out infinite;
}

html.dark .orb-l1 { background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12), transparent 70%); }
html.dark .orb-l2 { background: radial-gradient(circle, rgba(var(--accent-dark-rgb), 0.10), transparent 70%); }
html.dark .orb-l3 { background: radial-gradient(circle, rgba(var(--accent-rgb), 0.08), transparent 70%); }

@keyframes driftL1 {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(30px,25px) scale(1.1); }
}
@keyframes driftL2 {
  0%,100% { transform: translate(0,0); }
  50% { transform: translate(-25px,-20px) scale(1.12); }
}
@keyframes driftL3 {
  0%,100% { transform: translate(0,0); }
  33% { transform: translate(-20px,15px); }
  66% { transform: translate(15px,-10px); }
}

.particle, .particle-left {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.particle {
  background: rgba(var(--accent-rgb), 0.5);
  animation: rise linear infinite;
}

.particle-left {
  background: rgba(var(--accent-rgb), 0.35);
  animation: riseLeft linear infinite;
}

html.dark .particle-left { background: rgba(var(--accent-rgb), 0.5); }

@keyframes rise {
  0% { opacity: 0; transform: translateY(60vh) scale(0); }
  10% { opacity: 0.7; }
  90% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

@keyframes riseLeft {
  0% { opacity: 0; transform: translateY(60vh) scale(0); }
  10% { opacity: 0.5; }
  90% { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

.card-wrapper {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  border-radius: 1rem;
  margin-bottom: 1rem;
  animation: fadeUp 0.5s ease both;
}

.card-border {
  position: relative;
  border-radius: 1rem;
  padding: 2px;
  overflow: hidden;
}

.card-border::before {
  content: '';
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  border-radius: 1rem;
  background: conic-gradient(
    transparent 0deg,
    transparent 60deg,
    var(--accent) 90deg,
    var(--accent-dark) 120deg,
    transparent 150deg,
    transparent 210deg,
    var(--accent-dark) 240deg,
    var(--accent) 270deg,
    transparent 300deg,
    transparent 360deg
  );
  animation: rotateBorder 4s linear infinite;
  z-index: 0;
}

@keyframes rotateBorder {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.form-container {
  background: var(--bg-card);
  border-radius: calc(1rem - 2px);
  padding: 2.25rem 2rem;
  position: relative;
  z-index: 1;
}

.form-container h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.7rem;
  margin-bottom: 1.15rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
}

.alert-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: #dc2626;
}

html.dark .alert-danger { background: rgba(239,68,68,0.15); color: #f87171; }

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.3s;
  z-index: 1;
  font-size: 18px;
}

.input-wrap input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.85rem 3rem 0.85rem 2.7rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-wrap input::placeholder { color: var(--text-muted); }

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-wrap input:focus ~ .input-icon { color: var(--accent); }

.eye-btn {
  position: absolute;
  right: 0.45rem;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  z-index: 2;
  font-size: 18px;
  padding: 0;
  line-height: 1;
}

.eye-btn:hover { color: var(--accent); border-color: var(--accent); }
.eye-btn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }

.btn-enter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  border-radius: 0.7rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-enter:hover:not(:disabled) {
  box-shadow: 0 6px 30px rgba(var(--accent-rgb), 0.4);
  transform: translateY(-1px);
}

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

.btn-enter .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinAnim 0.6s linear infinite;
}

.btn-enter.loading .btn-text { display: none; }
.btn-enter.loading .spinner { display: inline-block; }

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

.btn-back {
  display: block;
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #64748b, #475569);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  border-radius: 0.7rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-back:hover {
  box-shadow: 0 6px 30px rgba(100,116,139,0.4);
  transform: translateY(-1px);
}

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem;
  background: #25d366;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  border: none;
  border-radius: 0.7rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s;
}

.btn-whatsapp:hover {
  box-shadow: 0 6px 30px rgba(37,211,102,0.4);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.bottom-info {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

.bottom-info strong {
  color: var(--text-secondary);
  display: block;
}

.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.online-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%,100% { opacity:1; }
  50% { opacity:.6; }
}

.panel-right {
  flex: 1;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
}

html.dark .panel-right {
  background: #ffffff;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.orb-a {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 70%);
  top: -8%; right: -10%;
  animation: drift1 18s ease-in-out infinite;
}

.orb-b {
  width: 250px; height: 250px;
  background: radial-gradient(circle, rgba(var(--accent-dark-rgb), 0.12), transparent 70%);
  bottom: 5%; left: -5%;
  animation: drift2 22s ease-in-out infinite;
}

html.dark .orb-a { background: radial-gradient(circle, rgba(var(--accent-rgb), 0.06), transparent 70%); }
html.dark .orb-b { background: radial-gradient(circle, rgba(var(--accent-dark-rgb), 0.04), transparent 70%); }

@keyframes drift1 {
  0%,100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-40px,30px) scale(1.1); }
}

@keyframes drift2 {
  0%,100% { transform: translate(0,0); }
  50% { transform: translate(35px,-25px) scale(1.15); }
}

.brand-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 420px;
  animation: fadeUp 0.6s ease 0.15s both;
}

.brand-content img {
  height: auto;
  max-height: 120px;
  max-width: 100%;
  margin-bottom: 2.5rem;
}

.logo-white {
  filter: brightness(0) invert(1);
}

html.dark .logo-white {
  filter: none;
}

.brand-content h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1.5rem;
  line-height: 1.3;
  transition: color 0.3s;
}

html.dark .brand-content h2 {
  color: #0f172a;
  font-weight: 900;
}

.brand-content h2 span { color: var(--accent); }
html.dark .brand-content h2 span { color: var(--accent); }

.feature-list {
  list-style: none;
  text-align: left;
  margin-bottom: 2rem;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.82rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
  transition: all 0.3s;
}

html.dark .feature-list li {
  color: #334155;
  font-weight: 500;
  border-bottom: 1px solid #e2e8f0;
}

.feature-list li:last-child { border-bottom: none; }

.feature-list .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 0.4rem;
}

html.dark .feature-list .dot {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(var(--accent-rgb), 0.3);
}

.brand-footer {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  transition: color 0.3s;
}

html.dark .brand-footer {
  color: #64748b;
  font-weight: 600;
}

.dark-toggle {
  position: fixed;
  top: 1rem; right: 1rem;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 10;
  font-size: 20px;
}

.dark-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

html.dark .dark-toggle {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.15);
  color: rgba(0,0,0,0.5);
}

html.dark .dark-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-sun, .icon-moon { line-height: 1; }
.icon-sun { display: inline; }
.icon-moon { display: none; }
html.dark .icon-sun { display: none; }
html.dark .icon-moon { display: inline; }

html.dark .logo-left {
  filter: brightness(0) invert(1);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  body { flex-direction: column-reverse; }
  .panel-right { padding: 2rem 1.5rem; min-height: auto; }
  .brand-content img { max-height: 80px; margin-bottom: 1.5rem; }
  .brand-content h2 { font-size: 1.35rem; margin-bottom: 1rem; }
  .feature-list { margin-bottom: 1.25rem; }
  .feature-list li { font-size: 0.75rem; padding: 0.5rem 0; }
  .panel-left { padding: 1.5rem; }
  .form-container h1 { font-size: 1.35rem; }
  .dark-toggle {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-secondary);
  }
}