/* ══ AUTH SCREEN ══ */
#auth-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: background 0.25s;
}

.auth-card {
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--sh-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  animation: authFadeIn 0.3s ease;
}

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

.auth-logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--blue);
  margin-bottom: 4px;
}

.auth-tagline {
  font-size: 14px;
  color: var(--t2);
  margin-bottom: 28px;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--t1);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: var(--blue);
}

.auth-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-btn:active { transform: scale(0.97); }

.auth-btn-primary {
  background: var(--blue);
  color: #fff;
}

.auth-btn-primary:hover {
  opacity: 0.9;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.auth-links a {
  font-size: 13px;
  color: var(--blue);
  cursor: pointer;
  font-weight: 500;
}

.auth-err {
  background: var(--red-l);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.5;
}

.auth-ok {
  background: var(--green-l);
  color: var(--green);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
  line-height: 1.5;
}

/* Spinner inside button */
.auth-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ══ USER PILL IN HEADER ══ */
.user-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface2);
  border-radius: 20px;
  padding: 4px 10px 4px 5px;
  cursor: default;
}

.user-av {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-email {
  font-size: 12px;
  color: var(--t2);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signout-link {
  font-size: 12px;
  color: var(--t3);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
  transition: all 0.15s;
  border: none;
  background: none;
  font-family: inherit;
}

.signout-link:hover {
  background: var(--red-l);
  color: var(--red);
}

/* ══ SYNC STATUS ══ */
.sync-status {
  font-size: 11px;
  color: var(--t3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.sync-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.sync-dot.busy {
  background: var(--orange);
  animation: pulse 1s ease-in-out infinite;
}

.sync-dot.error {
  background: var(--red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Mobile header ── */
@media (max-width: 768px) {
  .user-pill { padding: 4px 10px 4px 4px; gap: 5px; }
  .user-av   { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }
  .user-email { display: none; }
  .signout-link { font-size: 12px; padding: 4px 8px; white-space: nowrap; min-height: 32px; display: flex; align-items: center; }
}

/* ── Mobile login ── */
@media (max-width: 480px) {
  #auth-screen { padding: 0; align-items: flex-end; }
  .auth-card   { border-radius: 22px 22px 0 0; padding: 32px 24px 48px; max-width: 100%; }
  .auth-logo   { font-size: 22px; }
  .auth-input  { font-size: 16px; padding: 14px; }
  .auth-btn    { padding: 16px; font-size: 17px; min-height: 52px; }
}
