/* The sign-in page (public/login): the app's own colours, type and corners (src/index.css), in light and dark, without
   any of its bundle. */
:root {
  --background: #f3f5f9;
  --foreground: #121620;
  --card: #ffffff;
  --muted: #eaeef4;
  --muted-foreground: #5b6478;
  --primary: #0b63c9;
  --primary-foreground: #ffffff;
  --secondary: #e7ebf2;
  --secondary-foreground: #1b2130;
  --destructive: #ba1e38;
  --busy: #8f5400;
  --border: #dde2ec;
  --input: #d3d9e4;
  --ring: #0b63c9;
  --shadow: 0 1px 2px rgb(16 20 30 / 0.04), 0 8px 24px rgb(16 20 30 / 0.06);
  color-scheme: light;
}
:root.dark {
  --background: #121620;
  --foreground: #e6eaf2;
  --card: #1a2030;
  --muted: #212839;
  --muted-foreground: #959eb3;
  --primary: #7cc7ff;
  --primary-foreground: #06121f;
  --secondary: #242c3f;
  --secondary-foreground: #e6eaf2;
  --destructive: #f47c8d;
  --busy: #f5b84a;
  --border: rgb(255 255 255 / 0.08);
  --input: rgb(255 255 255 / 0.12);
  --ring: #7cc7ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  /* no page zoom on a phone, as in the app (src/index.css, lib/pageZoom.ts): a finger still scrolls, taps have no delay */
  touch-action: pan-x pan-y;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, Roboto,
    sans-serif;
  font-size: 15px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
}

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) calc(env(safe-area-inset-right, 0px) + 16px)
    calc(env(safe-area-inset-bottom, 0px) + 24px) calc(env(safe-area-inset-left, 0px) + 16px);
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 380px) {
  .card {
    padding: 24px 18px 20px;
  }
}

.mark {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  margin: 0 auto 2px;
}
h1 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  line-height: 26px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.sub {
  margin: -8px 0 4px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--muted);
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
}
.note.warn {
  background: color-mix(in srgb, var(--busy) 14%, var(--card));
  color: var(--foreground);
}

.btn {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--input);
  border-radius: 999px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  cursor: pointer;
  transition: filter 120ms cubic-bezier(0.2, 0, 0, 1), opacity 120ms cubic-bezier(0.2, 0, 0, 1);
}
.btn.primary {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-foreground);
}
.btn:hover:not(:disabled) {
  filter: brightness(0.96);
}
:root.dark .btn:hover:not(:disabled) {
  filter: brightness(1.12);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn:focus-visible,
.reveal:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#passkey-box:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.waiting {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 18px;
}
.waiting .spinner {
  margin-top: 1px;
}

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.elsewhere {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 18px;
}
a {
  color: var(--primary);
  text-underline-offset: 2px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
label {
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}
.field {
  position: relative;
}
input[type="password"],
input[type="text"]:not([hidden]) {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--input);
  border-radius: 16px;
  background: var(--card);
  color: var(--foreground);
  padding: 12px 48px 12px 14px;
  font: inherit;
  font-size: 16px; /* (smaller, and iOS zooms in on it) */
  line-height: 22px;
  letter-spacing: 0.02em;
}
input[aria-invalid="true"] {
  border-color: var(--destructive);
}
input:disabled {
  opacity: 0.6;
}
.reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  translate: 0 -50%;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.reveal .eye-off,
.reveal[aria-pressed="true"] .eye {
  display: none;
}
.reveal[aria-pressed="true"] .eye-off {
  display: block;
}
.hint {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 16px;
}
code {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", Consolas, monospace;
  font-size: 0.95em;
  background: var(--muted);
  border-radius: 6px;
  padding: 1px 5px;
  white-space: nowrap;
}
.error {
  margin: 0;
  color: var(--destructive);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}
form .btn {
  margin-top: 6px;
}

.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.spinner[hidden] {
  display: none;
}
@keyframes spin {
  to {
    rotate: 360deg;
  }
}

.foot {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
