/* Portal Integrado — estilo das telas de acesso (login/register/forgot).
   Identidade visual aprovada na prévia em /docs/preview-login.html. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #0d3370; --navy-deep:#061a3d;
  --text:#0f172a; --muted:#64748b; --line:#e2e8f0;
  --danger:#b91c1c; --danger-bg:#fef2f2; --danger-line:#fecaca;
  --success:#16a34a;
  --warn:#b45309; --warn-bg:#fffbeb; --warn-line:#fde68a;
}
html, body { height: 100%; overflow: hidden; }
body { font-family: 'Inter', -apple-system, sans-serif; color: var(--text); background:#0a1226; }

.behind {
  position: fixed; inset: 0; z-index: 1;
  background:
    radial-gradient(800px 600px at 50% 40%, rgba(56,189,248,.18), transparent 60%),
    linear-gradient(135deg, #0b1d3f 0%, #0d3370 100%);
  display:flex; align-items:center; justify-content:center; color:#fff; text-align:center;
}
.welcome { opacity: 0; transform: translateY(20px); transition: opacity .7s ease .35s, transform .7s ease .35s; }
.welcome h2 { font-size: 40px; font-weight: 800; letter-spacing:-.5px;
  background: linear-gradient(90deg, #fff, #cfe2ff); -webkit-background-clip:text; background-clip:text; color:transparent; }
.welcome p  { margin-top: 8px; opacity:.7; font-size: 15px; }
body.opening .welcome { opacity: 1; transform: translateY(0); }

.half { position: fixed; top:0; bottom:0; width:50%; overflow:hidden; z-index: 10;
  transition: transform 1s cubic-bezier(.77,0,.18,1); will-change: transform; }
.half.left { left:0; } .half.right { right:0; }
body.opening .half.left  { transform: translateX(-100%); }
body.opening .half.right { transform: translateX( 100%); }

.half .stage { position: absolute; top:0; bottom:0; width: 200vw;
  background:
    radial-gradient(1100px 700px at 12% 18%,  rgba(56,189,248,.22) 0%, transparent 60%),
    radial-gradient(900px 700px at 88% 82%,  rgba(129,140,248,.20) 0%, transparent 60%),
    radial-gradient(700px 500px at 50% 50%,  rgba(37,99,235,.15)  0%, transparent 70%),
    linear-gradient(135deg, #061a3d 0%, #0d3370 55%, #1e3a8a 100%);
}
.half.left  .stage { left: 0; }
.half.right .stage { left: -100vw; }
.half .stage::before { content:''; position:absolute; inset:0; opacity:.08;
  background-image:
    linear-gradient(rgba(255,255,255,.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.6) 1px, transparent 1px);
  background-size: 44px 44px; animation: drift 26s linear infinite; }
@keyframes drift { to { background-position: 44px 44px; } }
.half.left  .orb.a, .half.right .orb.b, .half.right .orb.c { display:block; }
.orb { position:absolute; border-radius:50%; filter: blur(40px); opacity:.55; animation: float 16s ease-in-out infinite; display:none; }
.orb.a { width:520px; height:520px; top:-160px; left:-120px; background: radial-gradient(circle, rgba(56,189,248,.6), transparent 60%); }
.orb.b { width:460px; height:460px; bottom:-180px; right:-140px; animation-delay:-7s; background: radial-gradient(circle, rgba(129,140,248,.55), transparent 60%); }
.orb.c { width:280px; height:280px; top:55%; left:-180px; animation-delay:-3s; background: radial-gradient(circle, rgba(37,99,235,.45), transparent 60%); }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(20px,-30px) scale(1.05); } }

.wrap { position: fixed; inset: 0; z-index: 20; display:flex; align-items:center; justify-content:center; padding: 24px; pointer-events: none; }
.card { pointer-events: auto; width: min(960px, 100%);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.15);
  border-radius: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: grid; grid-template-columns: 1fr 1fr; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
  transition: opacity .5s ease, transform .5s ease;
  animation: cardIn .8s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes cardIn { from { opacity:0; transform: translateY(24px) scale(.98); } to { opacity:1; transform: none; } }
body.opening .card { animation: none !important; opacity: 0 !important; transform: scale(.92) !important; pointer-events: none; }

.brand { position: relative; padding: 44px 40px; color:#fff;
  background: linear-gradient(160deg, rgba(13,51,112,.55), rgba(6,26,61,.35));
  display:flex; flex-direction:column; justify-content:space-between; min-height: 600px; }
.brand::after { content:''; position:absolute; inset:0; pointer-events:none;
  background: radial-gradient(380px 280px at 20% 30%, rgba(56,189,248,.18), transparent 60%); }
.logo { display:flex; align-items:center; gap:14px; position:relative; z-index:1; }
.logo-mark { width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  display:flex; align-items:center; justify-content:center;
  font-weight: 900; font-size: 22px; color:#0a1226;
  box-shadow: 0 14px 30px rgba(56,189,248,.35); animation: pulse 4.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: translateY(0); box-shadow: 0 14px 30px rgba(56,189,248,.35); } 50% { transform: translateY(-4px); box-shadow: 0 22px 40px rgba(129,140,248,.45); } }
.logo-text { font-size: 18px; font-weight: 800; letter-spacing: 1.4px; }
.logo-sub  { font-size: 11px; opacity: .55; margin-top: 2px; letter-spacing: .12em; text-transform: uppercase; }

.tagline { position:relative; z-index:1; }
.tagline h1 { font-size: 38px; line-height: 1.1; letter-spacing:-1px; font-weight: 800;
  background: linear-gradient(90deg, #fff 30%, #cfe2ff 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline h1 em { color: rgba(255,255,255,.45); font-style: normal; }
.tagline p { margin-top: 14px; font-size: 14px; color: rgba(255,255,255,.65); line-height: 1.7; max-width: 360px; }

.badge { position: relative; z-index:1; display:inline-flex; align-items:center; gap:8px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06); font-size: 11px; color: rgba(255,255,255,.75); width: max-content; }
.badge .dot { width:7px; height:7px; border-radius:50%; background:#22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.18); }

.form-side { background:#fff; padding: 40px; display:flex; flex-direction:column; justify-content:center; min-height: 600px; }
.eyebrow { align-self: flex-start; padding: 5px 12px; border-radius: 999px;
  background: rgba(13,51,112,.08); color: var(--navy);
  font-size: 11px; font-weight: 700; letter-spacing:.12em; text-transform: uppercase; margin-bottom: 14px; }
.form-title { font-size: 26px; font-weight: 800; letter-spacing:-.5px; }
.form-sub   { font-size: 13px; color: var(--muted); margin-top: 4px; margin-bottom: 22px; }

.field { margin-bottom: 12px; }
.field-row { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display:block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input, .select { width:100%; padding: 11px 14px; font: inherit; color: var(--text);
  background:#f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; transition: all .15s ease; }
.input.has-eye { padding-right: 38px; }
.select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z'/%3e%3c/svg%3e");
  background-repeat:no-repeat; background-position: right 12px center; background-size: 16px; }
.input::placeholder { color: #94a3b8; }
.input:focus, .select:focus { outline: none; border-color: var(--navy); background:#fff; box-shadow: 0 0 0 4px rgba(13,51,112,.12); }
.toggle-eye { position:absolute; right:8px; top:50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 8px; display:flex; align-items:center; justify-content:center;
  cursor: pointer; user-select:none; color:#64748b; font-size:14px; }
.toggle-eye:hover { background:#f1f5f9; color: var(--navy); }

.row { display:flex; align-items:center; justify-content: space-between; margin: 4px 0 14px; font-size: 12px; }
.row label { display:flex; gap:8px; align-items:center; color: var(--muted); cursor:pointer; }
.link { color: var(--navy); font-weight: 600; text-decoration: none; cursor:pointer; background:none; border:none; padding:0; font-family:inherit; font-size: inherit; }
.link:hover { text-decoration: underline; }

.btn { width:100%; padding: 12px 16px;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a8a 100%);
  color:#fff; border:none; border-radius: 10px; font-size: 14px; font-weight: 700; letter-spacing:.2px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .2s ease;
  box-shadow: 0 12px 28px rgba(13,51,112,.35); }
.btn:hover  { transform: translateY(-1px); box-shadow: 0 18px 32px rgba(13,51,112,.45); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--line); box-shadow: none; }
.btn.secondary:hover { background:#f8fafc; transform: none; box-shadow: none; }
.btn .spin { display:none; width:16px; height:16px; border:2px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right:8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading .spin { display:inline-block; }

.divider { display:flex; align-items:center; gap:10px; margin: 18px 0; color: var(--muted); font-size: 11px; }
.divider::before, .divider::after { content:''; flex:1; height:1px; background: var(--line); }

.foot { text-align:center; font-size: 13px; color: var(--muted); }
.foot a, .foot .link { color: var(--navy); font-weight: 600; text-decoration: none; }
.secure { display:inline-flex; align-items:center; gap:6px; padding: 5px 12px; border:1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--muted); margin-top: 12px; }
.secure .dot { width:6px; height:6px; border-radius:50%; background:#16a34a; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.alert--error   { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger); }
.alert--info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert--success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }

.notice { padding: 16px; border-radius: 12px; line-height: 1.55; border: 1px solid; font-size: 13px; margin-bottom: 16px; }
.notice--warn    { background: var(--warn-bg); border-color: var(--warn-line); color: #78350f; }
.notice--success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.notice b { font-weight: 700; display:block; margin-bottom: 6px; color: inherit; }

.shake { animation: shake .55s cubic-bezier(.36,.07,.19,.97) both; }
.shake .input { border-color: var(--danger); background:#fff8f8; }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-8px); } 40%,60% { transform: translateX(8px); } }

@media (max-width: 820px) {
  .card { grid-template-columns: 1fr; }
  .brand { min-height: auto; padding: 28px; }
  .tagline h1 { font-size: 30px; }
  .form-side { padding: 28px; min-height: auto; }
  .half { display:none; }
  .behind { background: linear-gradient(135deg, #061a3d 0%, #0d3370 55%, #1e3a8a 100%); }
  .field-row { grid-template-columns: 1fr; }
}
