.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(circle at 50% 18%, rgba(166, 56, 48, 0.08), transparent 34%),
    #f8f6f2;
}

.startup-screen {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: #f7f9f7;
  color: #1f6b57;
}

body.auth-pending .startup-screen {
  display: grid;
}

body.auth-pending .login-screen {
  display: none;
}

.startup-brand {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.startup-screen p {
  margin: 0;
  color: #6d7b75;
  font-size: 12px;
}

.startup-screen i {
  width: 18px;
  height: 18px;
  border: 2px solid #d2e2db;
  border-top-color: #1f6b57;
  border-radius: 50%;
  animation: startup-spin 0.8s linear infinite;
}

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

body:not(.auth-pending):not(.auth-required) .login-screen {
  display: none;
}

body.auth-pending .app,
body.auth-required .app {
  visibility: hidden;
  pointer-events: none;
}

.login-panel {
  position: relative;
  width: min(420px, 100%);
  padding: 38px 38px 30px;
  border: 1px solid #e5dfd9;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(67, 45, 37, 0.09);
}

.login-cancel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: #f4f1ed;
  color: #343936;
  font-size: 26px;
  font-weight: 300;
}

.login-cancel[hidden] {
  display: none;
}

.login-brand {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  border-radius: 16px;
  background: #a63830;
  color: #fff;
  font-family: ui-serif, Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.login-heading {
  text-align: center;
}

.login-heading > span {
  color: #a63830;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.login-heading h1,
.login-heading p {
  margin: 0;
}

.login-heading h1 {
  margin-top: 7px;
  color: #202321;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.login-heading p {
  max-width: 320px;
  margin: 10px auto 0;
  color: #7a7e7a;
  font-size: 12px;
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #4c514d;
  font-size: 12px;
  font-weight: 650;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #ded9d3;
  border-radius: 13px;
  outline: none;
  background: #fbfaf8;
  color: #202321;
  font: inherit;
  font-size: 14px;
}

.login-form input:focus {
  border-color: #ba6b64;
  box-shadow: 0 0 0 3px rgba(166, 56, 48, 0.09);
}

.login-form > button {
  min-height: 48px;
  margin-top: 3px;
  border: 0;
  border-radius: 13px;
  background: #a63830;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
}

.login-form > button:disabled {
  opacity: 0.64;
}

.login-status {
  margin: 0;
  padding: 9px 11px;
  border-radius: 10px;
  background: #fbefec;
  color: #8b332d;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.login-status[hidden] {
  display: none;
}

.login-footnote {
  margin: 22px 0 0;
  color: #989b97;
  font-size: 10.5px;
  text-align: center;
}

.quota-low-notice {
  min-height: 24px;
  margin: 0 4px -2px;
  padding: 0 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8a8e89;
  font-size: 10.5px;
  font-weight: 500;
}

.quota-low-notice #quotaLowNoticeButton {
  min-height: 24px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #777c77;
  font-size: 10.5px;
  font-weight: 600;
}

.quota-low-notice:hover #quotaLowNoticeButton {
  color: #a63830;
  background: transparent;
}

.usage-token-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.usage-token-breakdown > h3 {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  color: #303431;
  font-size: 13px;
}

.usage-token-item {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e7e2dc;
  border-radius: 11px;
  background: #faf9f7;
}

.usage-token-item span,
.usage-token-item strong {
  display: block;
}

.usage-token-item span {
  color: #858985;
  font-size: 10px;
}

.usage-token-item strong {
  margin-top: 3px;
  overflow: hidden;
  color: #303431;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-token-models {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: #8a8e89;
  font-size: 10px;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .login-screen {
    place-items: stretch;
    padding: 0;
    background: #fff;
  }

  .login-panel {
    width: min(100%, 460px);
    min-height: 100dvh;
    justify-self: center;
    padding: max(72px, calc(env(safe-area-inset-top) + 54px)) 24px calc(30px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-cancel {
    top: max(14px, env(safe-area-inset-top));
  }

  .login-brand {
    margin-top: min(7dvh, 54px);
  }

  .login-heading h1 {
    font-size: 25px;
  }

  .login-form {
    margin-top: 32px;
  }

  .login-footnote {
    margin-top: 28px;
  }

  .quota-low-notice {
    margin: 0 4px;
    padding: 0 5px 2px;
  }
}
