/* SPS tokens — align with v0.3/app/src/styles.css */
:root {
  --sps-bg: #f8f5ef;
  --sps-bg-alt: #ede6da;
  --sps-text: #1a1a3a;
  --sps-heading: #111118;
  --sps-muted: #5c5c6a;
  --sps-card-border: rgba(44, 47, 99, 0.22);
  --sps-input-border: rgba(44, 47, 99, 0.34);
  --sps-placeholder: #4a4a5c;
  --sps-card-bg: #ffffff;
  --sps-primary: #f2b34c;
  --sps-primary-hover: #e38b2c;
  --sps-primary-text: #1a1a3a;
  --sps-link: #2c2f63;
  --sps-focus: rgba(245, 211, 122, 0.5);
  --sps-error: #b42318;
  --sps-success: #1b6e3c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--sps-text);
  background: var(--sps-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(242, 179, 76, 0.22), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(44, 47, 99, 0.06), transparent 50%);
  -webkit-font-smoothing: antialiased;
}

.storefront-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 12px 18px 24px;
}

.storefront-login__card {
  width: 100%;
  max-width: 400px;
  background: var(--sps-card-bg);
  border: 1px solid var(--sps-card-border);
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(26, 26, 58, 0.04),
    0 12px 32px rgba(26, 26, 58, 0.08);
  padding: 22px 20px 20px;
  overflow: hidden;
}

.storefront-login__brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  text-align: center;
  margin-bottom: 14px;
}

/* Dark band — compact; ~15% shorter than prior pass for mobile fold. */
.storefront-login__logo-wrap {
  width: calc(100% + 40px);
  margin: -22px -20px 8px;
  padding: 8px 14px 9px;
  border-radius: 16px 16px 0 0;
  background: radial-gradient(ellipse 120% 100% at 50% 0%, #2a1f4a 0%, #1a123d 45%, #121028 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.storefront-login__logo {
  display: block;
  width: min(64px, 28vw);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.storefront-login__title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sps-heading);
}

.storefront-login__subtitle {
  margin: 5px auto 0;
  max-width: 32ch;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--sps-muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

/* Compact default; expands when a message is shown (no large empty gap). */
.storefront-login__feedback {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  min-height: 0.375rem;
  margin: 2px 0 0;
}

.storefront-login__message {
  margin: 0;
  padding: 6px 12px;
  font-size: 0.8125rem;
  line-height: 1.45;
  border-radius: 8px;
  text-align: center;
}

.storefront-login__message--error {
  color: var(--sps-error);
  background: rgba(180, 35, 24, 0.08);
  border: 1px solid rgba(180, 35, 24, 0.25);
}

.storefront-login__message--success {
  color: var(--sps-success);
  background: rgba(27, 110, 60, 0.08);
  border: 1px solid rgba(27, 110, 60, 0.22);
}

/* Injected only after successful auth (see main.js). */
.storefront-signed-in {
  text-align: center;
  margin-bottom: 16px;
}

.storefront-signed-in__lead {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sps-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.storefront-signed-in__email {
  margin: 8px 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--sps-heading);
  word-break: break-all;
}

.storefront-signed-in__out {
  padding: 8px 16px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sps-link);
  background: transparent;
  border: 1px solid var(--sps-input-border);
  border-radius: 8px;
  cursor: pointer;
}

.storefront-signed-in__out:hover {
  background: var(--sps-bg-alt);
}

.storefront-login__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.storefront-login__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.storefront-login__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sps-heading);
}

.storefront-login__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--sps-text);
  background: #f3efe8;
  border: 1px solid var(--sps-input-border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.storefront-login__input::placeholder {
  color: var(--sps-placeholder);
  opacity: 1;
}

.storefront-login__input:hover {
  border-color: rgba(44, 47, 99, 0.42);
}

.storefront-login__input:focus {
  outline: none;
  border-color: var(--sps-primary-hover);
  box-shadow: 0 0 0 3px var(--sps-focus);
}

/* Single fused control: field + toggle share one border (no default button chrome). */
.storefront-login__input-wrap--password {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 44px;
  background: #f3efe8;
  border: 1px solid var(--sps-input-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.storefront-login__input-wrap--password:hover {
  border-color: rgba(44, 47, 99, 0.42);
}

.storefront-login__input-wrap--password:focus-within {
  border-color: var(--sps-primary-hover);
  box-shadow: 0 0 0 3px var(--sps-focus);
}

.storefront-login__input--with-toggle {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 10px 10px 10px 14px;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.storefront-login__input--with-toggle:focus {
  box-shadow: none;
}

.storefront-login__pw-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  margin: 0;
  min-width: 2.75rem;
  min-height: 44px;
  padding: 0 9px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--sps-link) 87%, transparent);
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-left: 1px solid rgba(44, 47, 99, 0.045);
  border-radius: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.storefront-login__pw-toggle:hover {
  background: rgba(44, 47, 99, 0.05);
}

.storefront-login__pw-toggle:active {
  background: rgba(44, 47, 99, 0.08);
}

.storefront-login__pw-toggle:focus {
  outline: none;
}

.storefront-login__pw-toggle:focus-visible {
  z-index: 1;
  box-shadow: inset 0 0 0 2px var(--sps-focus);
}

.storefront-login__meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: -2px;
  padding: 2px 0 0;
  min-height: 2.75rem;
}

.storefront-login__remember-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--sps-muted);
  cursor: pointer;
}

.storefront-login__remember-label input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  align-self: center;
  transform: translateY(-2.5px);
  accent-color: var(--sps-link);
}

.storefront-login__link--meta {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  color: var(--sps-link);
  flex-shrink: 0;
}

.storefront-login__link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sps-link);
  text-decoration: none;
}

.storefront-login__link:hover {
  text-decoration: underline;
}

.storefront-login__link:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--sps-focus);
}

.storefront-login__actions {
  margin-top: 0;
}

.storefront-login__submit {
  width: 100%;
  min-height: 2.75rem;
  padding: 8px 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--sps-primary-text);
  background: var(--sps-primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, transform 0.1s ease;
}

.storefront-login__submit:hover {
  background: var(--sps-primary-hover);
}

.storefront-login__submit:active {
  transform: scale(0.99);
}

.storefront-login__submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--sps-focus);
}

.storefront-login__secondary {
  margin: 4px 0 0;
  text-align: center;
  font-size: 0.8125rem;
}

.storefront-login__secondary .storefront-login__link {
  font-weight: 600;
}

/* Link-styled buttons (Forgot password / Create account) — no default button chrome */
.storefront-login__link-btn {
  display: inline;
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  text-align: inherit;
  vertical-align: baseline;
}

.storefront-login__link-btn:hover {
  text-decoration: underline;
}

.storefront-login__link-btn:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--sps-focus);
}

.storefront-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.storefront-modal.hidden {
  display: none;
}

.storefront-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 24, 0.45);
}

.storefront-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  max-height: min(90dvh, 560px);
  overflow: auto;
  padding: 22px 20px 20px;
  background: var(--sps-card-bg);
  border: 1px solid var(--sps-card-border);
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(26, 26, 58, 0.06),
    0 16px 40px rgba(26, 26, 58, 0.14);
}

.storefront-modal__title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--sps-heading);
}

.storefront-modal__text {
  margin: 0 0 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--sps-muted);
}

.storefront-modal__field {
  margin-bottom: 12px;
}

.storefront-modal__msg {
  margin: 0 0 14px;
  font-size: 0.875rem;
  line-height: 1.45;
}

.storefront-modal__msg.hidden {
  display: none;
}

.storefront-modal__msg--success {
  color: var(--sps-success);
}

.storefront-modal__msg--error {
  color: var(--sps-error);
}

.storefront-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.storefront-modal__actions--stack {
  flex-direction: column;
  align-items: stretch;
}

.storefront-modal__btn {
  min-height: 2.5rem;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.15s ease, transform 0.1s ease;
}

.storefront-modal__btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.storefront-modal__btn--primary {
  color: var(--sps-primary-text);
  background: var(--sps-primary);
}

.storefront-modal__btn--primary:hover:not(:disabled) {
  background: var(--sps-primary-hover);
}

.storefront-modal__btn--primary:active:not(:disabled) {
  transform: scale(0.99);
}

.storefront-modal__btn--primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--sps-focus);
}

.storefront-modal__btn--secondary {
  color: var(--sps-link);
  background: var(--sps-bg-alt);
  border: 1px solid var(--sps-card-border);
}

.storefront-modal__btn--secondary:hover:not(:disabled) {
  background: var(--sps-bg);
}

.storefront-modal__btn--secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--sps-focus);
}
