/* Stage 9B-1: sign-in screen, session lock and signed-in account chip.
   Uses the design tokens defined at the top of styles.css. */

/* Keep the demo markup out of sight until auth.js has decided what to show. */
body:not(.auth-ready) .app-shell {
  visibility: hidden;
}

.auth-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 32px);
  width: 400px;
}

.auth-dialog::backdrop {
  background: var(--bg, #f4f6f1);
}

/* Over a loaded app (session lock) let the screen show through faintly. */
body.auth-ready .auth-dialog::backdrop {
  background: rgba(22, 34, 28, 0.55);
  backdrop-filter: blur(3px);
}

.auth-card {
  background: var(--surface, #fff);
  color: var(--ink, #16221c);
  border: 1px solid var(--line, #d9e0da);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px 24px 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.auth-brand .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--green, #1f8a5b);
  color: #fff;
  font-weight: 800;
}

.auth-brand strong {
  display: block;
  font-size: 15px;
}

.auth-brand span:not(.brand-mark) {
  display: block;
  color: var(--muted, #6a766f);
  font-size: 12px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.25;
}

.auth-intro {
  margin: 0 0 18px;
  color: var(--muted, #6a766f);
  font-size: 14px;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.auth-form input {
  height: var(--ds-control-height, 40px);
  padding: var(--ds-control-padding, 10px 12px);
  border: 1px solid var(--line, #d9e0da);
  border-radius: var(--ds-radius, 8px);
  font: inherit;
  font-weight: 400;
  background: var(--surface, #fff);
  color: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--green, #1f8a5b);
  box-shadow: var(--ds-focus);
}

.auth-form input[readonly] {
  background: var(--surface-2, #eef4ef);
  color: var(--muted, #6a766f);
}

.auth-message {
  min-height: 18px;
  margin: -4px 0 0;
  font-size: 13px;
}

.auth-message.error {
  color: var(--ds-danger-text, #b42318);
}

.auth-message.info {
  color: var(--ds-info-text, #1f5fbf);
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-footnote {
  margin: 16px 0 0;
  color: var(--muted, #6a766f);
  font-size: 12px;
}

.link-button {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue, #2367d1);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

/* Signed-in account chip in the top bar */
.auth-account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-account-text {
  display: grid;
  min-width: 0;
  line-height: 1.2;
  text-align: right;
}

.auth-account-text strong {
  font-size: 13px;
}

.auth-account-text span {
  overflow: hidden;
  color: var(--muted, #6a766f);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-signout {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .auth-account-text {
    display: none;
  }
}

/* The app styles these labels as flex, which overrides [hidden]. */
.account-role-switcher[hidden] {
  display: none !important;
}

/* Shared data save status (shared-store.js) */
.auth-sync {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ds-success-text, #147849);
}
.auth-sync[data-sync-status="saving"] { color: var(--muted, #6a766f); }
.auth-sync[data-sync-status="error"] { color: var(--ds-danger-text, #b42318); }
