:root {
  --c-ink-900: #0f172a;
  --c-ink-700: #334155;

  --c-teal-700: #2c5570;
  --c-teal-600: #336991;
  --c-teal-500: #3e6b8c;

  --text: var(--c-ink-900);
  --text2: #64748b;
  --text3: #94a3b8;

  --accent: #3e6b8c;
  --accent-strong: #3e6b8c;

  --signal-red: #be3232;
  --signal-red-deep: #a03535;
  --signal-red-light: #ffe2e2;
  --signal-red-border: #e8a2a2;
  --signal-green: #238b57;
  --signal-green-deep: #2b6f4e;
  --signal-green-light: #cfeedd;
  --signal-green-border: #94c8ad;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(980px 640px at -16% -24%, rgba(62, 107, 140, 0.14), transparent 72%),
    radial-gradient(760px 520px at 110% 118%, rgba(15, 23, 42, 0.1), transparent 74%),
    #f8f9fc;
}

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-wrap::before {
  content: '';
  position: absolute;
  width: 420px;
  height: 420px;
  top: -160px;
  right: 12%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(62, 107, 140, 0.12) 0%, rgba(62, 107, 140, 0) 74%);
  pointer-events: none;
}

.login-wrap::after {
  content: '';
  position: absolute;
  width: 480px;
  height: 480px;
  bottom: -200px;
  left: 18%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0) 76%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 36px 32px 28px;
  background: #ffffff;
  border: 1px solid #dce6ef;
  border-radius: 24px;
  box-shadow: 0 44px 80px -38px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-card.selection-mode {
  max-width: 460px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.login-logo-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 56px;
}

.login-brand-footer {
  position: relative;
  z-index: 1;
  margin: 22px auto 0;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.login-brand-footer strong {
  color: #475569;
  font-weight: 700;
}

.login-card h2 {
  margin: 0 0 18px;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: #0f172a;
  text-align: center;
}

.login-auth-view.hidden {
  display: none;
}

.login-error,
.login-info {
  display: none;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 14px;
}

.login-error {
  background: var(--signal-red-light);
  border: 1px solid var(--signal-red-border);
  color: var(--signal-red-deep);
}

.login-info {
  background: var(--signal-green-light);
  border: 1px solid var(--signal-green-border);
  color: var(--signal-green-deep);
}

.login-info.visible,
.login-error.visible {
  display: flex;
}

.login-error .material-icons {
  font-size: 18px;
  flex-shrink: 0;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 9px 10px 9px 13px;
  border: 1px solid #b8c5d4;
  border-left: 3px solid rgba(62, 107, 140, 0.45);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input::placeholder {
  color: #94a3b8;
}

.login-field input:focus {
  border-color: rgba(62, 107, 140, 0.55);
  border-left-color: #3e6b8c;
  box-shadow: 0 0 0 3px rgba(62, 107, 140, 0.15);
}

.login-btn {
  width: 100%;
  margin-top: 22px;
  padding: 11px 12px;
  border: 1px solid rgba(62, 107, 140, 0.3);
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 16px 26px -20px rgba(62, 107, 140, 0.48);
  transition: filter 0.16s ease, box-shadow 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 18px 28px -18px rgba(62, 107, 140, 0.5);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-btn[data-busy='true']::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  animation: login-btn-spin 0.8s linear infinite;
}

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

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dce6ef;
}

.login-google-btn {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #dce6ef;
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-google-btn:hover:not(:disabled) {
  border-color: rgba(62, 107, 140, 0.35);
  color: #2c5570;
}

.login-google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-google-btn[data-busy='true']::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #94a3b8;
  border-right-color: transparent;
  animation: login-btn-spin 0.8s linear infinite;
}

.login-google-btn[data-busy='true'] .login-google-icon {
  display: none;
}

.login-google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.login-register-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(62, 107, 140, 0.16);
  text-align: center;
}

.login-register-box p {
  margin: 0 0 6px;
  font-size: 12px;
  color: #64748b;
}

.login-register-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.login-register-link:hover {
  text-decoration: underline;
}

.firma-selection-view {
  display: none;
  margin-top: 6px;
  padding: 18px;
  border: 1px solid #dce6ef;
  border-radius: 18px;
  background: #ffffff;
}

.firma-selection-view.visible {
  display: block;
}

.firma-selection-title {
  margin: 0;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.firma-selection-subtitle {
  margin: 8px 0 14px;
  font-size: 13px;
  color: #64748b;
}

.firma-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.firma-select-btn {
  text-align: left;
  border: 1px solid #dce6ef;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.firma-select-btn:hover:not(.is-disabled) {
  border-color: rgba(62, 107, 140, 0.42);
  box-shadow: 0 16px 24px -22px rgba(62, 107, 140, 0.36);
  transform: translateY(-1px);
}

.firma-select-btn.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
  background: #f8fafc;
  border-color: rgba(62, 107, 140, 0.14);
}

.firma-select-name {
  display: block;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.firma-select-meta {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #64748b;
}

.firma-select-status {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--signal-green-deep);
}

.firma-select-status.is-disabled {
  color: var(--signal-red-deep);
}

.firma-selection-back-btn {
  margin-top: 14px;
  width: 100%;
  border: 1px solid #dce6ef;
  background: #ffffff;
  color: #334155;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.firma-selection-back-btn:hover {
  border-color: rgba(62, 107, 140, 0.35);
  color: #2c5570;
}

.firma-selection-error {
  margin-top: 12px;
}

@media (max-width: 480px) {
  .login-wrap {
    padding: 14px;
  }

  .login-card {
    padding: 28px 20px 24px;
    border-radius: 18px;
  }

  .login-card.selection-mode {
    max-width: 100%;
  }

  .login-card h2 {
    font-size: 20px;
  }

  .login-logo-name {
    font-size: 18px;
  }

  .firma-selection-view {
    padding: 14px;
    border-radius: 14px;
  }
}

@media (max-width: 360px) {
  .login-card {
    padding: 22px 16px 20px;
  }
}
