/* FlowVerify CLM sign-in. Colours mirror fv-app-v1/src/styles/theme.css. */

:root {
  --bg: #F8FAFB;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-strong: #94A3B8;
  --text: #0E1619;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --brand-surface: #0A3746;
  --brand-surface-hover: #0C4153;
  --focus: #0F6E8D;
  --link: #0F6E8D;
  --link-hover: #0B556B;
  --danger: #B42318;
  --danger-bg: #FEF3F2;
  --danger-border: #FECDCA;
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1014;
    --surface: #141C22;
    --border: #2F3E47;
    --border-strong: #56707D;
    --text: #ECF2F5;
    --text-secondary: #B7C5CD;
    --text-muted: #8FA2AB;
    --brand-surface: #1A6B85;
    --brand-surface-hover: #2080A0;
    --focus: #6FD3F0;
    --link: #6FD3F0;
    --link-hover: #8DDFF5;
    --danger: #FDA29B;
    --danger-bg: #2A1513;
    --danger-border: #5C2622;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px 36px 36px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand img {
  display: block;
  height: 34px;
  width: auto;
}

/* The wordmark's tick rises above its letters, so the letters sit below the
   image's centre; nudge the divider and "CLM" down to line up with them. */
.brand-divider,
.brand-product {
  position: relative;
  top: 2px;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--border-strong);
  opacity: 0.6;
}

.brand-product {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}

.heading {
  text-align: center;
  margin-bottom: 28px;
}

.heading h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.heading p {
  margin: 0;
  color: var(--text-secondary);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
}

.alert svg {
  flex: none;
  margin-top: 2px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  /* 16px keeps iOS Safari from zooming the page on focus. */
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.field input:hover {
  border-color: var(--focus);
}

.field input:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}

.field input[aria-invalid='true'] {
  border-color: var(--danger);
}

.field-error {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.password {
  position: relative;
}

.password input {
  padding-right: 64px;
}

.toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 32px;
  min-width: 48px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.toggle:hover {
  color: var(--link-hover);
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--brand-surface);
  color: #FFFFFF;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

.primary:hover {
  background: var(--brand-surface-hover);
}

.primary[aria-busy='true'] {
  cursor: progress;
  opacity: 0.85;
}

.toggle:focus-visible,
.primary:focus-visible,
.footer a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.primary[aria-busy='true'] .spinner {
  display: block;
}

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

.form-help {
  margin: 20px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-help a {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
}

.form-help a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.form-help a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
}

.footer a:hover {
  color: var(--link);
  text-decoration: underline;
}

@media (max-width: 480px) {
  .card {
    padding: 32px 20px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }

  .field input,
  .primary {
    transition: none;
  }
}
