#authGate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 18px;
  background: var(--panel, #fff);
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
}
.auth-card h1 { margin: 0 0 8px; }
.auth-card p { margin: 0 0 20px; opacity: .75; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { font-weight: 600; }
.auth-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  font: inherit;
}
.auth-form button { width: 100%; }
.auth-switch { margin-top: 14px; text-align: center; }
.auth-switch button { background: none; border: 0; cursor: pointer; text-decoration: underline; }
.auth-error { min-height: 1.4em; margin-top: 10px; color: #b42318; }
.auth-logout { margin-left: 8px; }

.password-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0,0,0,.35);
}
.password-modal[hidden] {
  display: none !important;
}
.password-card {
  width: min(440px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: var(--panel, #fff);
  box-shadow: 0 16px 50px rgba(0,0,0,.2);
}
.password-card h2 { margin: 0 0 8px; }
.password-card p { margin: 0 0 18px; opacity: .75; }
.password-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.password-actions button { width: 100%; }

/* Do not reveal the login gate or app until the initial session check finishes. */
body:not(.auth-ready) {
  visibility: hidden;
}

body.authenticated #authGate { display: none; }
body:not(.authenticated) #app,
body:not(.authenticated) .topbar,
body:not(.authenticated) .tabs { display: none; }
