:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f5f6f8;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(145deg, #ffffff 0%, #f1f3f6 100%);
}
button, input { font: inherit; }
a { color: inherit; }

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.auth-card {
  width: min(100%, 520px);
  background: #ffffff;
  border: 1px solid #dfe3e8;
  border-radius: 22px;
  padding: clamp(22px, 5vw, 34px);
  box-shadow: 0 24px 70px rgba(17, 24, 39, .1);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-mark {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #111111;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.2rem;
}
.eyebrow, .brand-note { margin: 0; }
.eyebrow { font-size: .75rem; letter-spacing: .16em; font-weight: 900; }
.brand-note { margin-top: 3px; color: #69707d; font-size: .88rem; }

.portal-heading { margin-bottom: 18px; }
.portal-heading h1 { margin: 0 0 7px; font-size: clamp(1.7rem, 6vw, 2.15rem); line-height: 1.08; }
.portal-heading p { margin: 0; color: #69707d; line-height: 1.5; }

.owner-access {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid #20242b;
  border-radius: 16px;
  background: linear-gradient(145deg, #111827, #1f2937);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(17, 24, 39, .16);
}
.owner-access h2 { color: #ffffff; }
.owner-access p:not(.owner-label) { margin: 0 0 14px; color: #d7dce4; line-height: 1.5; font-size: .9rem; }
.owner-access small { display: block; margin-top: 11px; color: #aeb7c6; line-height: 1.45; }
.owner-label { margin: 0 0 7px; color: #86efac; font-size: .72rem; letter-spacing: .14em; font-weight: 900; }
.github-owner-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 11px 14px;
  border: 1px solid #ffffff;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  text-align: center;
  text-decoration: none;
  font-weight: 900;
}
.github-owner-button:hover { background: #f1f5f9; }
.account-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: #7a818c;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.account-divider::before, .account-divider::after { content: ""; height: 1px; background: #dfe3e8; }

.method-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 6px;
  margin-bottom: 22px;
  border: 1px solid #d9dde3;
  border-radius: 14px;
  background: #f3f4f6;
}
.method-tab {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #5d6470;
  font-weight: 850;
  cursor: pointer;
}
.method-tab.active {
  background: #111111;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  margin-bottom: 20px;
  border: 1px solid #dfe2e7;
  border-radius: 12px;
  background: #f5f5f6;
}
.organization-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tab {
  min-width: 0;
  min-height: 42px;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #676e79;
  font-weight: 800;
  cursor: pointer;
}
.tab.active {
  background: #ffffff;
  color: #111111;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .13);
}

.auth-card h2 { margin: 0 0 8px; font-size: clamp(1.45rem, 5vw, 1.85rem); line-height: 1.15; }
.auth-card h3 { margin: 0 0 8px; }
.muted { margin: 0 0 20px; color: #69707d; line-height: 1.5; }

form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #232833; font-size: .94rem; font-weight: 780; }
label small { color: #747b87; font-size: .79rem; line-height: 1.35; font-weight: 500; }
input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  border: 1px solid #c9ced6;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  padding: 0 14px;
  outline: none;
}
input:focus { border-color: #111111; box-shadow: 0 0 0 3px rgba(17, 17, 17, .1); }

.primary-button, .secondary-button, .text-button {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 850;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.primary-button { border: 1px solid #111111; background: #111111; color: #ffffff; }
.secondary-button { border: 1px solid #c6cbd2; background: #ffffff; color: #111111; }
.text-button { border: 0; background: transparent; color: #303640; }
.primary-button:disabled, .secondary-button:disabled, .text-button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, summary:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(17, 17, 17, .2); outline-offset: 2px; }

.inline-actions { margin-top: 8px; }
.compact-link { min-height: 40px; padding: 8px; text-decoration: underline; }
.active-link { font-weight: 900; }
.more-options { margin-top: 14px; border-top: 1px solid #e1e4e8; padding-top: 14px; }
summary { cursor: pointer; color: #3f4650; font-weight: 780; }
.quick-access { display: grid; gap: 9px; margin-top: 12px; }
.recovery-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.recovery-actions .text-button { min-height: 42px; text-decoration: underline; }

.hint, .recovery-note { color: #707782; font-size: .82rem; line-height: 1.45; }
.recovery-note { margin: 14px 0 0; }
.message { min-height: 1.25rem; margin: 11px 0 0; color: #a11212; font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.message.success { color: #17663a; }

.recovery-result {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #e5b84f;
  border-radius: 14px;
  background: #fffaf0;
}
.recovery-result p { color: #676e79; line-height: 1.5; }
.recovery-result pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 13px;
  border-radius: 10px;
  background: #111827;
  color: #ffffff;
  font: .88rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.portal-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e1e4e8;
  color: #545b66;
  font-size: .88rem;
  font-weight: 700;
}

@media (max-width: 560px) {
  .auth-shell { place-items: start center; padding: 0; }
  .auth-card {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    box-shadow: none;
  }
  .brand-row { margin-bottom: 20px; }
}

@media (max-width: 360px) {
  .method-tabs, .organization-tabs, .recovery-actions { grid-template-columns: 1fr; }
  .auth-card { padding-left: 16px; padding-right: 16px; }
}
