/* mailflow · Auth-Gate (Login, Lizenz) — kein Inline-CSS in den Views */

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

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

body.auth-page {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.auth-header {
  flex-shrink: 0;
  background: var(--bg-header);
  color: var(--text-on-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding:
    max(28px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    32px
    max(24px, env(safe-area-inset-left));
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand img {
  height: 26px;
  width: auto;
  display: block;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    32px
    max(24px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

.auth-stack {
  width: 100%;
  max-width: 400px;
}

.auth-stack--wide {
  max-width: 460px;
}

.auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0 0 14px;
}

.auth-title {
  margin: 0;
  font-size: var(--text-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-primary);
}

.auth-hint {
  margin: 6px 0 0;
  font-size: var(--text-label);
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 36em;
}

.auth-panel {
  background: var(--bg);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.04);
}

.auth-panel-body {
  padding: 20px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
  font-size: var(--text-body);
}

.auth-field > span {
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
}

.auth-field input {
  width: 100%;
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  background: var(--bg);
  color: var(--text-primary);
  text-align: center;
}

.auth-field input.auth-input-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  height: 40px;
  letter-spacing: 0.02em;
}

.auth-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auth-pin-label {
  display: block;
  margin: 0 0 10px;
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 500;
}

.auth-stack--login {
  max-width: none;
  width: auto;
}

.auth-stack--login .auth-head {
  margin-bottom: 20px;
}

.auth-pin {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0;
}

.auth-pin input {
  width: 48px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.05);
  color: var(--text-primary);
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  caret-color: var(--accent);
}

.auth-pin input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.auth-pin input.is-filled {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--accent-bg), 0 1px 2px rgba(15, 20, 25, 0.05);
}

.auth-pin input:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
}

.auth-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
  font-size: var(--text-label);
  line-height: 1.4;
  text-align: center;
  display: none;
}

.auth-error.visible {
  display: block;
}

.auth-link {
  display: inline-flex;
  color: var(--accent);
  font-weight: 500;
  font-size: var(--text-label);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-footer-link {
  margin: 20px 0 0;
  text-align: center;
}

.auth-reset-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  font-size: var(--text-body);
}

.auth-reset-form .field > span {
  color: var(--text-secondary);
  font-size: var(--text-caption);
  font-weight: 500;
}

.auth-reset-form input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg);
  color: var(--text-primary);
}

.auth-reset-form input[type="password"],
.auth-reset-form input[inputmode="numeric"] {
  font-size: 18px;
  letter-spacing: 0.2em;
  text-align: center;
}

.auth-reset-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.auth-hint code {
  font-size: 12px;
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (min-width: 720px) {
  .auth-header {
    min-height: 200px;
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: 44px;
  }

  .auth-brand img {
    height: 32px;
  }

  .auth-stack--login .auth-title {
    font-size: 28px;
  }

  .auth-stack--login .auth-hint {
    font-size: 15px;
  }

  .auth-stack--login .auth-head {
    margin-bottom: 28px;
  }

  .auth-pin {
    gap: 14px;
  }

  .auth-pin input {
    width: 64px;
    height: 76px;
    border-radius: var(--radius-lg);
    font-size: 32px;
  }
}
