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

:root {
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-active: #1e40af;
  --primary-soft:   #eff6ff;
  --focus-ring:     rgba(37, 99, 235, 0.18);

  --ink:            #0f172a;
  --text-soft:      #475569;
  --muted:          #64748b;
  --placeholder:    #94a3b8;

  --bg:             #ffffff;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-hover:   #cbd5e1;
  --surface-soft:   #f3f4f6;

  --error-bg:       #fef2f2;
  --error-text:     #b91c1c;
  --error-border:   #fecaca;
  --success-bg:     #f0fdf4;
  --success-text:   #15803d;
  --success-border: #bbf7d0;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.06);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.logo-mark {
  color: var(--primary);
  font-size: 20px;
  line-height: 1;
}

.logo-name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

h1 {
  color: var(--ink);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 28px;
}

.alert {
  border-radius: 8px;
  font-size: 14.5px;
  margin-bottom: 20px;
  padding: 11px 14px;
}

.alert--error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.alert--success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

label {
  color: var(--text-soft);
  font-size: 14.5px;
  font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  min-height: 48px;
  outline: none;
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

input::placeholder {
  color: var(--placeholder);
}

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

input:focus,
input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 48px;
}

.toggle-password {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  transition: color 0.15s, background 0.15s;
  width: 36px;
}

.toggle-password:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.toggle-password:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.toggle-password[aria-pressed="true"] {
  color: var(--primary);
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

button[type="submit"] {
  background: var(--primary);
  border: none;
  border-radius: 9px;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.003em;
  margin-top: 14px;
  min-height: 48px;
  padding: 12px;
  transition: background 0.15s, transform 0.05s;
  width: 100%;
}

button[type="submit"]:hover {
  background: var(--primary-hover);
}

button[type="submit"]:active {
  background: var(--primary-active);
  transform: translateY(1px);
}

button[type="submit"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

button[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.footer-link {
  color: var(--muted);
  font-size: 14px;
  margin-top: 24px;
  text-align: center;
}

.footer-link a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.footer-link a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-link a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (max-width: 480px) {
  .card {
    border: none;
    box-shadow: none;
    padding: 24px 20px;
  }

  h1 {
    font-size: 24px;
  }
}
