/* Sign-in screen, account panel, and no-access states (Phase 0). */

/* Auth states: the dashboard shell only shows once the session is confirmed. */
body:not([data-auth="signed-in"]) .app-shell { display: none; }
body[data-auth="signed-in"] .auth-screen { display: none; }
body[data-auth="checking"] .auth-form,
body[data-auth="signed-out"] .auth-checking { display: none; }

.auth-screen {
  display: grid;
  min-height: calc(100vh - var(--footer-height, 56px));
  padding: 40px 16px;
  place-items: center;
  background:
    radial-gradient(circle at 18% 12%, #b7dcff1f, transparent 42%),
    radial-gradient(circle at 86% 88%, #4c586699, transparent 48%),
    linear-gradient(150deg, var(--brand-charcoal), #34414a 58%, var(--brand-slate));
}

.auth-card {
  position: relative;
  width: min(100%, 408px);
  padding: 34px 34px 30px;
  border: 1px solid #73818d;
  border-radius: 14px;
  background: linear-gradient(160deg, #4c5866f2, #3b4751f2);
  box-shadow: 0 24px 60px rgba(8, 14, 20, .42);
}

.auth-brand { margin-bottom: 26px; text-align: center; }
.auth-brand img { display: block; width: 184px; max-width: 70%; height: auto; margin: 0 auto; }
.auth-brand p { margin: 4px 0 0; color: #d1dce4; font-size: 10px; font-weight: 800; letter-spacing: .2em; }

.auth-checking {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 120px;
  color: #d1dce4;
  font-weight: 600;
}
.auth-checking i { color: #b7dcff; font-size: 20px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-heading h1 { font-size: 26px; }
.auth-heading p { margin: 6px 0 0; color: #d1dce4; font-size: 13px; }

.auth-notice {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #c07a82;
  border-radius: 8px;
  background: #5a343bcc;
  color: #ffe8e8;
  font-size: 13px;
}
.auth-notice[data-tone="info"] { border-color: #8ecdf266; background: #8ecdf21f; color: #eaf6ff; }

.auth-field { display: flex; flex-direction: column; gap: 6px; color: #d1dce4; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.auth-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #82909b;
  border-radius: 8px;
  background: var(--brand-charcoal);
  transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus-within { border-color: #b7dcff; box-shadow: 0 0 0 3px #b7dcff33; }
.auth-input > i { flex: 0 0 16px; color: #9fb0bd; font-size: 14px; text-align: center; }
.auth-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.auth-reveal {
  display: grid;
  width: 30px;
  height: 30px;
  margin-right: -6px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #b8c6d1;
}
.auth-reveal:hover { background: #ffffff14; color: #fff; }
.auth-reveal:focus-visible { outline: 2px solid #b7dcff; outline-offset: 1px; }

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  margin-top: 4px;
  border: 1px solid #a6d4ff;
  border-radius: 8px;
  background: #2f7fd8;
  color: #fff;
  font-weight: 700;
  transition: background .15s;
}
.auth-submit:hover:not(:disabled) { background: #3b8ce6; }
.auth-submit:focus-visible { outline: 2px solid #b7dcff; outline-offset: 2px; }
.auth-submit:disabled { cursor: progress; opacity: .78; }

.auth-help { margin: 0; color: #b8c6d1; font-size: 12px; text-align: center; }

.api-target-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border: 1px solid #ffad6a88;
  border-radius: 999px;
  background: #ffad6a1f;
  color: #ffd2ad;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Account panel at the bottom of the sidebar. */
.sidebar { overflow-y: auto; }
/* Sticky so sign-out stays reachable when the nav scrolls on short screens; the shadows mask content scrolling beneath. */
.account-panel {
  position: sticky;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: auto 10px 12px;
  padding: 12px;
  border: 1px solid #72808b;
  border-radius: 10px;
  background: #3d4851;
  box-shadow: 0 12px 0 12px #4c5866, 0 -14px 16px -4px #4c5866;
}
.account-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-identity > div { display: flex; flex-direction: column; min-width: 0; }
.account-identity strong { overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-identity span:not(.account-avatar) { color: #b8c6d1; font-size: 11px; font-weight: 600; }
.account-avatar {
  display: grid;
  flex: 0 0 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-slate);
  color: #d1dce4;
  font-size: 13px;
}
.account-league { display: flex; flex-direction: column; gap: 4px; color: #b8c6d1; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.account-league select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #82909b;
  border-radius: 6px;
  outline: none;
  background: var(--brand-slate);
  color: var(--text);
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}
.account-league select:focus { border-color: #b7dcff; box-shadow: 0 0 0 3px #b7dcff33; }
.account-league select:disabled { cursor: default; opacity: 1; }
.account-signout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  border: 1px solid #82909b;
  border-radius: 6px;
  background: transparent;
  color: #e3ebf1;
  font-size: 12px;
  font-weight: 700;
}
.account-signout:hover { border-color: #b7dcff; background: #b7dcff14; color: #fff; }

/* Locked sections stay visible in navigation and open the no-access message. */
.side-link.is-locked,
.tab.is-locked { opacity: .72; }
.side-link .lock-badge { margin-left: auto; color: #b8c6d1; font-size: 11px; }
.tab > .lock-badge { display: inline; margin-left: -3px; font-size: 10px; }

.access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 48px auto;
  padding: 36px 32px;
  border: 1px solid #73818d;
  border-radius: 12px;
  background: linear-gradient(155deg, var(--brand-slate), #3e4b56);
  text-align: center;
}
.access-denied-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  place-items: center;
  border: 1px solid #b7dcff55;
  border-radius: 50%;
  background: #b7dcff1a;
  color: #b7dcff;
  font-size: 22px;
}
.access-denied h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.access-denied p { max-width: 440px; margin: 10px 0 0; color: #d1dce4; font-size: 14px; }
.access-denied-permissions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.access-denied-permissions code {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid #82909b;
  border-radius: 6px;
  background: var(--brand-charcoal);
  color: #f7fafc;
  font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.access-denied .access-denied-account { margin-top: 20px; color: #b8c6d1; font-size: 12px; }
.access-denied-account strong { color: #f7fafc; }

@media (max-width: 520px) {
  .auth-card { padding: 28px 22px 24px; }
  .access-denied { margin: 20px auto; padding: 28px 20px; }
}

@media print {
  .account-panel, .auth-screen { display: none !important; }
}
