/* NEUROapp — camada de acesso (login, convite, sem acesso, shell). Não afeta o app interno. */
:root {
  --brand: #5A5FA6;
  --brand-deep: #3D4172;
  --brand-soft: #F1EFFC;
  --brand-line: #C6C8E8;
  --ink: #2B2E45;
  --ink-2: #383B57;
  --muted: #6B7089;
  --line: #E2E6F5;
  --bg: #F4F6FC;
  --surface: #FFFFFF;
  --gold: #D89B3A;
  --cream: #F5EFE0;
  --danger: #B03A2E;
  --danger-bg: #FBEAE2;
  --ok: #3D7350;
  --ok-bg: #E7F2EA;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(20, 20, 40, 0.12);
  --font-sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font-sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }

/* ---------- Página de autenticação ---------- */
.page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 920px; display: grid; grid-template-columns: 1fr 1.1fr; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.brand-panel { background: var(--brand); color: var(--brand-soft); padding: 40px 36px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; position: relative; overflow: hidden; }
.brand-panel::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.14), rgba(255,255,255,0) 70%); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-deep); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { display: flex; align-items: baseline; gap: 1px; }
.brand-name .n { font: 700 22px/1.2 var(--font-mono); letter-spacing: 0.01em; color: var(--cream); }
.brand-name .a { font: 700 23px/1.2 var(--font-serif); color: var(--gold); margin-left: 1px; }
.brand-tag { font-size: 13px; color: var(--brand-line); margin-top: 6px; }
.brand-copy h2 { font: 600 26px/1.25 var(--font-serif); color: #fff; margin: 0 0 10px; }
.brand-copy p { margin: 0; color: #DDE0F8; font-size: 14px; }
.brand-foot { font-size: 12px; color: var(--brand-line); }

.form-panel { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.form-panel h1 { font: 600 24px/1.25 var(--font-serif); color: var(--ink); margin: 0 0 6px; }
.form-panel .sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field input { font: 400 15px/1.4 var(--font-sans); color: var(--ink); background: #F9FAFD; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; width: 100%; }
.field input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(90, 95, 166, 0.18); }
.field .hint { font-size: 12px; color: var(--muted); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 76px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--brand); font: 600 12px/1 var(--font-sans); cursor: pointer; padding: 8px 10px; border-radius: 8px; }
.pw-toggle:hover { background: var(--brand-soft); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 20px; }
.link { background: none; border: none; padding: 0; color: var(--brand); font: 600 13px/1.4 var(--font-sans); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 10px; font: 600 15px/1.2 var(--font-sans); padding: 13px 18px; cursor: pointer; text-decoration: none; transition: background .15s, opacity .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover:not([disabled]) { background: #4A4E90; }
.btn-secondary { background: var(--brand-soft); color: var(--brand-deep); }
.btn-secondary:hover:not([disabled]) { background: #E1E3F7; }
.btn-block { width: 100%; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.alert { border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #F1CFC2; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #CFE3D5; }
.alert-info { background: var(--brand-soft); color: var(--brand-deep); border-color: #DDE0F8; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(90,95,166,.25); border-top-color: var(--brand); width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-block { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); padding: 24px 0; text-align: center; }

.status-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 36px 32px; max-width: 520px; width: 100%; box-shadow: var(--shadow); text-align: center; }
.status-card h1 { font: 600 24px/1.3 var(--font-serif); margin: 14px 0 8px; }
.status-card p { color: var(--muted); margin: 0 0 20px; }
.status-card .brand { justify-content: center; }
.status-card .brand-mark { width: 40px; height: 40px; }
.status-card .brand-name .n { color: var(--ink); font-size: 20px; }
.status-card .brand-name .a { font-size: 21px; }
.status-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; margin-top: 18px; }

@media (max-width: 760px) {
  .auth-card { grid-template-columns: 1fr; max-width: 460px; }
  .brand-panel { padding: 26px 24px; gap: 14px; }
  .brand-copy h2 { font-size: 20px; }
  .brand-copy p, .brand-foot { display: none; }
  .form-panel { padding: 28px 22px 30px; }
}

/* ---------- Shell autenticado (/app) ---------- */
html.shell-html, html.shell-html body { height: 100%; overflow: hidden; background: #F4F6FC; }
.app-frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; margin: 0; padding: 0; display: block; background: #F4F6FC; }
.acct { position: fixed; right: 14px; bottom: 14px; z-index: 2147483000; font-family: var(--font-sans); }
.acct-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6); background: var(--brand-deep); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: .55; box-shadow: 0 4px 14px rgba(20,20,40,.22); transition: opacity .15s, transform .15s; padding: 0; }
.acct-btn:hover, .acct-btn:focus-visible, .acct-btn[aria-expanded="true"] { opacity: 1; }
.acct-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.acct-menu { position: absolute; right: 0; bottom: 46px; width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; }
.acct-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.acct-email { font-size: 14px; color: var(--ink); font-weight: 600; margin: 4px 0 12px; word-break: break-all; }
.acct-menu .btn { width: 100%; padding: 10px 14px; font-size: 14px; }
.shell-msg { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); z-index: 2147483001; font: 500 15px/1.5 var(--font-sans); }
